Matlab: sum(a') Perl: $sum = map{ my $c = 0; map{ $c += $_; }@$_; $c; } @$a;