in reply to fun(?) with +=

Please note that:

$foo = shift || 1; # is the same as $foo = (shift || 1);
and
$foo = shift or 1; # is the same as ($foo = shift) or 1;

see perldoc perlop about Operator Precedence

Replies are listed 'Best First'.
Re^2: fun(?) with +=
by Aristotle (Chancellor) on Jan 02, 2005 at 22:41 UTC
    $ perl -MO=Deparse,-p -e'$foo = shift || 1' ($foo = (shift(@ARGV) || 1)); -e syntax OK

    Makeshifts last the longest.