\my @path = $some_array_ref; my $accumulator; for my $i (0..@$path) { $accumulator += $path[$i]; }