XP is just a number | |
PerlMonks |
Re: Declaring with my, assigning, and testing in same line (scope)by tye (Sage) |
on Dec 11, 2015 at 14:56 UTC ( [id://1150039]=note: print w/replies, xml ) | Need Help?? |
It's the scoping of the parentheses around the my assignment that causes the problem. The parens have nothing to do with it. A 'my' declaration has no effect until the statement after the 'my'. This is, at least in part, so you can do:
As to your question, you can get away with:
But I'm not sure it is worth it. - tye
In Section
Seekers of Perl Wisdom
|
|