in reply to How do you determine the size of array reference?
I've Super Searched, I've GoogledReally? Try this: array size, or determine array size in perl.
But, what do you really mean by array size? The number of elements?
The memory size?my @array = (1 ..4); my $size = @array; print "The size of array \@array is $size\n";
Should you used an array reference, then you could do the same.use Devel::Size 'size'; my @array = (1 ..4); my $size = size(\@array); print "The size of array \@array is $size\n";
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 |