[Israel.pm] losing my sanity?
sawyer x
xsawyerx at gmail.com
Thu Sep 8 01:22:23 PDT 2011
On Thu, Sep 8, 2011 at 11:15 AM, Gabor Szabo <szabgab at gmail.com> 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. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20110908/2a319441/attachment.htm
More information about the Perl
mailing list