http://qs1969.pair.com?node_id=710312


in reply to sum of continues array

hi sanku, what about this:
my @array=(1,2,3,4,-1,-2,-3,11,12,13); my @sums=(); my $last=0; map { push @sums, $last+$_ if $last>0 and $_>0; $last=$_; } @array; my $max=0; map {$max=$_ if $_>$max } @sums; print "Max sum: $max\n";