Perl Idioms Explained - && and || "Short Circuit" operatorsC:\>perl -MO=Deparse,-p -e" my $foo = shift || die 666;" (my $foo = (shift(@ARGV) || die(666))); -e syntax OK C:\>perl -MO=Deparse,-p -e" my $foo = shift or die 666;" ((my $foo = shift(@ARGV)) or die(666)); -e syntax OK C:\>perl -e" my $foo = shift || die 666;" 666 at -e line 1. C:\>perl -e" my $foo = shift or die 666;" 666 at -e line 1. C:\>
In reply to Re^2: what's wrong with this?
by Anonymous Monk
in thread what's wrong with this?
by Alien
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |