with 5.12, also with 5.10 and presumably earlier too:

>perl -le 'sub Q{@_[0,1,2] = (7,6,5)}; Q($a,$b,$c); print qq[$a $b $c\n];'
7 6 5
>perl -le 'sub Q{@_ = (7,6,5)}; Q($a,$b,$c); print qq[$a $b $c\n];'

>

I was trying to have a subroutine that resets the variables passed to
it when it is called; the second line is the approach I took, it
didn't work. The first approach works though. It appears that in the
second one, we're assigning to a fresh array variable, the old one's
contents having first been jettisoned, instead of overwriting the
elements therein.

The massive headaches that would ensue if my initial approach did what
I wanted are easy to imagine. Or are they? When an array variable
holds copies instead of aliases, as they usually do, there would be
difference.
_______________________________________________
kc mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/kc

Reply via email to