There's more than one way to do things | |
PerlMonks |
Re: What's happening in this expression? (Updated)by LanX (Saint) |
on Oct 11, 2020 at 12:42 UTC ( [id://11122699]=note: print w/replies, xml ) | Need Help?? |
> but instead do: > my $a, $x, $y, $z = foo() The precedence of = is higher than , ! Resulting evaluation: (my $a), ($x), ($y), ($z = foo()) That's effectively the same like 4 separate statements. my $a ; $x ; $y ; $z = foo() ;
Consequences1. => scalar assignment to $z and scalar context for foo() call 2. => my declaration only for $a
Update3. => $x and $y are undeclared and in void context 4. => strict will fail In short: DON'T!!!
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|