[Israel.pm] perl -e weirdness

Eitan Schichmanter ESchichmanter at cloverleafcomm.com
Thu Aug 12 04:30:55 PDT 2004


Does anybody have any idea why:
perl -e 'print "Hello' -e 'World\n"'

1. Even works?
2. prints a newline after the "Hello"?

Weird...
P.S., this happens for both 5.004_04 and 5.8.0 .

Thanks,
-- 
Offer Kaye


Offer,

Under Windows 2K, Perl 5.8.4, build 810 it doesn't work:

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


On Solaris 8 it works as you've descirbed, under perl 5.8.2
My guess (as good as any) is that somehow the 2nd -e is interpolated as a seperate call for the interpeter, and thus it 'ends' the first instance, causing a newline to be created, then continues with the 2nd execution of the interpreter and thus you receive the newline.

The platform change or the version change escapes me however (I hardly believe Perl 5.8.2 and 5.8.4 are so different with cli execution. Most likely it's an OS thing).

Try to post to the activeperl list (activeperl at listserv.ActiveState.com) and perhaps they can shed more light on this phenomenon.

HTH

Eitan.




More information about the Perl mailing list