$a = 1; $b = 0; print "OR\n" if $a or $b; print "AND\n" if $a and $b; if ($a) { if ($b) { print "AND\n"; } else { print "OR\n"; } } elsif ($b) { if ($a) { print "AND\n"; } else { print "OR\n"; } }
In reply to Re^4: John Guttag's book - 2nd exercise. My attempt in Perl.
by Anonymous Monk
in thread John Guttag's book - 2nd exercise. My attempt in Perl.
by pritesh_ugrankar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |