Typically, the problem is that command interpreters on these systems have quite different ideas about quoting than the Unix shells that were created as single-line ones. On some systems, you may have to change the single quotation marks to double quotes, which you should NOT do on a Unix or Plan9 system. You may also have to change one % to a %% . For instance:
# Unix (including Mac OS X) perl -e 'print "Hello world\n"' # DOS, etc. perl -e "print \"Hello world\n\"" # Mac Classic print "Hello world\n" (then Run "Myscript" or Shift-Command-R) # MPW perl -e 'print "Hello world\n"' # VMS perl -e "print ""Hello world\n"""
The problem is that none of these examples are reliable: they depend on the shell. On Unix, the first two often work. In DOS, it is possible that neither works. If 4DOS was a shell, you probably would have been lucky with this:
perl -e "print <Ctrl-x>"Hello world\n<Ctrl-x>""
On a Mac, it depends on which environment you are in with. The MacPerl or MPW shell is the same as the Unix shell in its support for several citation options, except that it uses Mac non-ASCII characters for free as control characters.
Using qq() , q() and qx() instead of double quotes, single quotes, and backticks can make single-line files easier to write. There is no general solution to all of this. It's a mess.