in reply to Re^2: Determine first element in foreach
in thread Determine first element in foreach

It's harder to introduce an off-by-one error, and easier to spot a mistake.

Indeed. Consider
    for ($i = 0; $i < $#mylist ; $i++) { ... }
in reply above:  $i < $#mylist vice  $i <= $#mylist — or did you have that in mind?

Replies are listed 'Best First'.
Re^4: Determine first element in foreach
by tobyink (Canon) on Aug 05, 2014 at 07:17 UTC

    I hadn't even noticed that! (Which is precisely my point.)