in reply to
Re: Length of 2-dimensional array
in thread Length of 2-dimensional array
This could also be written as:
my $a; # a 2d-array
$count += $#$_+1;
print "My 2D-array is $count long\n";
my $a = [[1,2,3],[4,5,6,7],];
my $count = 0;
$count += @$_ for @$a;
$you = new YOU;
honk() if $you->love(perl)
$a = [ [ 0..2 ], [0..10],[0..100] ];
my ($min, $max,$sum) = (undef, 0, 0);
$sum += my $a_length = @$_;
$min = $a_length if $a_length < $min or not defined $min;
$max = $a_length if $a_length > $max;
my $avg = $sum/ @$a;
print "Avg: $avg; Min: $min; Max: $max\n";
"We are not alone"(FZ)
By rote learning.
Via Genetic memory.
It's provided by my firmware.
I just remember them.
Thirty days hath September
My computer gets it right, usually.
I just ask someone else.
Someone punches me on the first of the month.
Results (50 votes),