[Israel.pm] perl -e weirdness

Eitan Schichmanter ESchichmanter at cloverleafcomm.com
Thu Aug 12 05:29:10 PDT 2004


On Thu, Aug 12, 2004 at 02:27:01PM +0300, Gaal Yahas wrote:
> On Thu, Aug 12, 2004 at 02:18:11PM +0300, Offer Kaye wrote:
> > Does anybody have any idea why:
> > perl -e 'print "Hello' -e 'World\n"'
> > 
> > 1. Even works?
> > 2. prints a newline after the "Hello"?
> 
> Multiple -e switches work by concatenating lines joined by newlines. You
> can verify this by running the following one-liner:
> 
> % perl -le 'print __LINE__;' -e 'print __LINE__'
> 1
> 2

Oops, sent to soon. So the point of the above is that your double-e'er
compiles to:

     print "Hello
     World\n"

And perl honors the inline newline.

Eitan, try using backticks instead of forward ticks on Windows.
Perversely, CMD.EXE prefers those as quote marks.

Gal,

Still no go (even with backticks - imagine that...):

H:\>perl -e `print "Hello` -e `World\n"`
Can't find string terminator "`" anywhere before EOF at -e line 1.

It refuses to work on my mahcine in Windoze, but works with regular quotes under the Solaris 8, no matter what combination of quotes/double-quotes or backticks I use...




More information about the Perl mailing list