in reply to How do you determine the size of array reference?

This...

I realize if I was using an array (rather than an array reference) I could use $#name or scalar( @Name ).
...makes me think you want the number of elements in a reference to an array. You need to convert your arrayref to an array, like so

my $arrayref = [ 1, 2, 3 ]; #step-by-step my @array = @$arrayref; # derefernce to array, @{ $arrayref } works to +o my $num_elements = @array; #in one step $num_elements = @$arrayref; #or, when in list context print scalar @$arrayref; #or, if it's the last element number you want print $#$arrayref;

Replies are listed 'Best First'.
Re^2: How do you determine the size of array reference?
by apl (Monsignor) on Jul 02, 2007 at 17:20 UTC
    Thank you for your time and your patience, FunkyMonk. That's exactly what I needed to know.