in reply to creating a variable in an if statement
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: creating a variable in an if statement
by shmem (Chancellor) on Jan 22, 2008 at 21:34 UTC | |
|
Re^2: creating a variable in an if statement
by ikegami (Patriarch) on Jan 22, 2008 at 21:36 UTC |