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 -e 'my $x = " @ARGV " =~ / h/ ? 0 : 1; exit $x' hah && echo good
good
$ perl -le 'print " @ARGV " =~ / h/ ? 0 : 1' hah && echo good
0
good
$ 
...................../\..........END........../\.....................

"perldoc perlintro" says:

> You can use parentheses for functions' arguments or omit
> them according to your personal taste.  They are only
> required occasionally to clarify issues of precedence.

"perldoc perlop" shows "=~" at level 6, and "? :" at level 18.

"perldoc -f exit" doesn't turn up anything weird either.

I am evidently overlooking something basic in the documentation, or my
much-anticipated dementia has finally set in.  Please help disprove the
latter possibility.  :-)

My command shell is "bash-2.05b", if that makes a difference.

TIA.

peace,                          || A sanctuary unlike any other:
--{kr.pA}                       || http://www.peaceabbey.org/
-- 
This sentence has nothing to do with Gandhi, and won't remind you of him.
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to