if (1 == (my @f = S1 || S2)) {
scalar context is forced upon the return of S1, but not on that of S2:
perl -le '@g = qw(a b c); @h = qw(d e); @f = @g || @h; print @f' 3 perl -le '@g = qw( ); @h = qw(d e); @f = @g || @h; print @f' de
What if S1 returns more than one element?
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re^2: creating a variable in an if statement
by shmem
in thread creating a variable in an if statement
by Tanktalus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |