On Tue, Jun 19, 2007 at 05:18:03PM -0400, Kripa Sundar wrote:
> Hello all,
>
> "exit <expr>" apparently behaves differently from
> "exit(<expr>)" when <expr> is not a simple scalar.
> See the example below.
>
> .....................\/.........BEGIN.........\/.....................
> $ perl -e 'exit " @ARGV " =~ / h/ ? 0 : 1' hah && echo good
> $ perl -e 'exit(" @ARGV " =~ / h/ ? 0 : 1)' hah && echo good
> good
% perl -MO=Deparse,-p -e 'exit " @ARGV " =~ / h/ ? 0 : 1'
(exit((" @ARGV " =~ / h/)) ? '???' : '???');
% perl -MO=Deparse,-p -e 'print " @ARGV " =~ / h/ ? 0 : 1'
print(((" @ARGV " =~ / h/) ? 0 : 1));
It seems that exit does not have the precedence one would expect. I don't
know why that is.
Ronald
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm