Skip to content

Instantly share code, notes, and snippets.

/a.pl

Created November 30, 2012 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4172935 to your computer and use it in GitHub Desktop.
Save anonymous/4172935 to your computer and use it in GitHub Desktop.
difference between && and 'and'
use common::sense;
sub a { say "a"; 2 }
sub b { say "b"; 0 }
sub c { say "c"; 1 }
sub ok { say "ok"; 3; }
sub nok { say "nok"; 4; }
my $x = a and b and c and ok or nok;
my $y = a && b && c && ok || nok;
say "x=$x, y=$y";
__DATA__
output:
a
b
nok
a
b
nok
x=2, y=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment