You live and learn. Thank you

 
Best Regards,
Dov Levenglick
SmartDSP OS Development Leader
From: [email protected] [mailto:[email protected]] On Behalf Of 
sawyer x
Sent: Thursday, September 08, 2011 11:22
To: Perl in Israel
Subject: Re: [Israel.pm] losing my sanity?

On Thu, Sep 8, 2011 at 11:15 AM, Gabor Szabo <[email protected]> wrote:
order of switches? 

try

perl -MCwd -e "print Cwd::getcwd();"

Indeed that is the problem.

-e expects the next string to be something to run. When you write "-e -MCwd", 
you're actually asking the perl interpreter to run the Perl code "-MCwd", which 
results in.. nothing. "-" is used for negation, and that line of "code" is 
basically negating "MCwd".

If you were to add strictures, you would get a warning.

$ perl -Mstrict -W -e -MCwd
Useless use of negation (-) in void context at -e line 1.

The reason this gets you a warning is because you're not doing anything with 
the value you got from the operation. If you were to use it, the warning would 
cease.

$ perl -Mstrict -W -e "print -MCwd"
-MCwd

The value of negating MCwd is .. -MCwd. :)

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to