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

I've Super Searched, I've Googled
Really? Try this: array size, or determine array size in perl.

But, what do you really mean by array size? The number of elements?

my @array = (1 ..4); my $size = @array; print "The size of array \@array is $size\n";
The memory size?
use Devel::Size 'size'; my @array = (1 ..4); my $size = size(\@array); print "The size of array \@array is $size\n";
Should you used an array reference, then you could do the same.
my @array = (1 ..4); my $ar_ref = \@array; my $size = @$ar_ref; print "The size of array \@array is $size\n"; use Devel::Size 'size'; my $memory = size($ar_ref); print "The size of array \@array is $memory\n";

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

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:17 UTC
    Many thanks, naikonta. My queries were along the lines of Perl array reference size. reference probably made it too specific, while size (in 20-20 hindsight) should have been something like number of elements.
    IAE, I thank you for your time.