[Israel.pm] losing my sanity?
RM07994 at freescale.com
Thu Sep 8 03:03:46 PDT 2011
You live and learn. Thank you
SmartDSP OS Development Leader
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] 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 <szabgab at gmail.com> wrote:
order of switches?
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"
The value of negating MCwd is .. -MCwd. :)
More information about the Perl