Thread Probleme mit mehrdimensionalen Arrays
(18 answers)
Opened by eXpli at 2011-01-07 10:27
Ansonsten kann man noch empfehlen immer Data::Dumper zu nutzen:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #!usr/bin/perl use strict; use warnings; use Data::Dumper; use List::Util qw/sum/; my $rows = [ [1, 2, 3], [1, 2, 3], [1, 2, 3], ]; my @row_sum = map { sum @$_ } @$rows; print Dumper \@row_sum; my $total_sum = sum @row_sum; print $total_sum . "\n"; Last edited: 2011-01-07 11:58:59 +0100 (CET) |