Phoenix.pm: yet another strange beast; $#$var as lvalue
Michael Dearman
mdearman at inficad.com
Thu Aug 24 05:36:18 CDT 2000
Hi,
Ran up on this in the Perl Algorithms book.
sub insertion_merge {
...
my $merge; # The merged result.
$#$merge = @$large + @$small - 1; # Pre-extend
and then $merge used as ref to an array?
$merge->[ $i ];
Two questions.
1. Could someone share where any documentation on the $#$var construct?
I know I've seen a discussion on manually pre-extending an array
instead of relying on Perl to auto-magically do this. But don't
remember seeing this.
2. But the real thing that gets me -
At what point and how does $merge become a ref to an array?
I kinda see what happens. But I'd appreciate it of someone
could put this to words ( or lyrics :)
$#$merge = @$arr_1 + @$arr_2 -1;
Thanks,
Mike D.
More information about the Phoenix-pm
mailing list