in reply to Re^3: Reading a array
in thread Reading a array
Exactly, if there is a @arr1 and you access it without any symbolic reference, then $#arr1 is scalar(@arr1)-1. Only @arr1 is accessed here, the value of $arr1 is irrelevant and isn't used at all
If we use $arr1 (totally different variable from @arr1) as a symbolic reference, then
@bingo=(1,2,3); $arr1='bingo'; print $#{$arr1}, scalar(@$arr1)-1, scalar(@bingo)-1;
would print 222, as all three print expressions would be equivalent. In this case @arr1 is irrelevant and not used at all, only $arr1 as the symbolic reference and @bingo as the array
|
|---|