You do realise that you aren't passing the array into modify()? You're passing a list. And that list is being aliased.
Yes I do :) It's a list of aliases, just like in the subroutine GetVolumeInformation from the original post.
p5p have buggered Perl5 in their attempts to 'be correct'.
I think this is related to some optimization. Some people like to use $#array = ... because it is faster than explicitly filling the array. However this optimization comes with a cost.
Assigning to the length does not put any SVs into the new elements, and this is why you cannot create references or aliases to them. I thought there was something about this in the documentation, but I cannot find it any more (only a related section in perlguts)
In reply to Re^6: What does my @x= (undef)x7; do?
by betterworld
in thread What does my @x= (undef)x7; do?
by gepebril69
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |