in reply to Largest Sum of Consecutive Integers

You may have a viable solution but it is buggy: the my $max = 0; is an obvious error because the problem is uninteresting without negative numbers.

Be well,
rir