in reply to Re: Looping backwards through two arrays at once?
in thread Looping backwards through two arrays at once?

ikegami,
Your suggestion of a C style for loop as an alternative feels odd to me. I would have written it as a while loop as it feels more natural.
my $i = @array; while ( $i-- ) { # ... }

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Looping backwards through two arrays at once?
by ikegami (Patriarch) on Nov 04, 2005 at 17:37 UTC

    I prefer for over while because

    • the index is scoped to the loop, and
    • I find it more readable since the bounds of the loop are on a single line.