in reply to last index of array ref...

Maybe you find it easier with braces.
$aref = [qw/1 2 3/]; print $#$aref; print $#{$aref}; # it is not the same as scalar(@$aref) print scalar(@$aref);
Boris