[Israel.pm] perl -e weirdness

Gaal Yahas gaal at forum2.org
Thu Aug 12 04:37:57 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.

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list