No idea about the camel book, I have to admit I never read it.
my understanding is that the values from RHS are temporarily pushed on a stack like structure and from there assigned to the LHS.
B::Concise shows
~$ perl -MO=Concise -e '($a,$b)=($b,$a)' a <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 9 <2> aassign[t5] vKS/COMMON ->a - <1> ex-list lKP ->6 3 <0> pushmark s ->4 - <1> ex-rv2sv sK/1 ->5 4 <#> gvsv[*b] s ->5 - <1> ex-rv2sv sK/1 ->- 5 <#> gvsv[*a] s ->6 - <1> ex-list lKPRM* ->9 6 <0> pushmark sRM* ->7 - <1> ex-rv2sv sKRM*/1 ->8 7 <#> gvsv[*a] s ->8 - <1> ex-rv2sv sKRM*/1 ->- 8 <#> gvsv[*b] s ->9 -e syntax OK
so you might wanna look into ex-list (where both sides are stored) and aassign ("array-assign" which is a misnomer).
Unfortunately I couldn't find a good compilation explaining all these ops.
From the Llama (Learning Perl, 3rd Edition)
3.4. List Assignment
In much the same way as scalar values may be assigned to variables, list values may also be assigned to variables:
($fred, $barney, $dino) = ("flintstone", "rubble", undef);
All three variables in the list on the left get new values, just as if we did three separate assignments. Since the list is built up before the assignment starts, this makes it easy to swap two variables' values in Perl:72
72) As opposed to in languages like C, which has no easy way to do this in general. C programmers usually resort to some kind of macro to do this, or use a variable to temporarily hold the value.
Hope this helps! :)
In reply to Re^6: Accessing Arguments inside Subroutines via @_
by LanX
in thread Accessing Arguments inside Subroutines via @_
by citi2015
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |