in reply to Re: For loop abortions
in thread For loop abortions
But the outer for my $i (0..scalar @sig) { ... } in both loop examples still seems to me to have an inherent off-by-one error. This error is masked by the fact that $#sig is used as the range limit in the $i+1..$#sig range expression of both inner loops.
But the inherent error (as I consider it) still remains, and must be fixed up or masked or otherwise dealt with in some way, and poses a potential pitfall for future programmers and maintainers. Why not use the more idiomatic (and IMHO correct) for my $i (0 .. $#sig) { ... } form in both outer loops?
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: For loop abortions
by Laurent_R (Canon) on Mar 18, 2016 at 18:34 UTC |