perl -wMstrict -e "sub S1 { return int rand 2 ? ('one 1') : () } sub S2 { return int rand 2 ? ('one 2') : ('bad', 'news') } for (0 .. shift) { if (1 == (my @f = S1 || S2)) { print @f } else { print 'not one' } print qq(\n); }" 10 one 1 one 1 one 1 not one one 2 not one one 2 one 1 not one one 1 not one
In reply to Re: creating a variable in an if statement
by Anonymous Monk
in thread creating a variable in an if statement
by Tanktalus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |