good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Will "$_[0]=shift" always resolve shift first?by betterworld (Curate) |
on Sep 08, 2008 at 21:44 UTC ( [id://709888]=note: print w/replies, xml ) | Need Help?? |
As you can see from the listing in perlop, the assignment operator ("=") has right associativity, which means that the right side is evaluated before the left side. Incidentally, this is the very reason that the following common idiom works as you expect:
Had "=" its left side evaluated first, the 42 would not make it into the $y variable, which would lead to code breakage all over the planet ;) Update: Hm, scratch that, I think I confused a few terms. The associativity tells us how the statement gets parsed, not how it gets executed.
In Section
Seekers of Perl Wisdom
|
|