in reply to Re: Accessing array elements
in thread Accessing array elements

But the set of people who avoid using C-style for loop are typically the ones that avoid $# as well.

I do use the C style for loop if I want the index, because, IMO, it's easier to avoid off-by-one errors than using foreach style. The latter means you either have to use '- 1', or remember to use '$#'.

for (my $i = 0; $i < @array; $i++) {...}
is standard idiom which translates easily between languages. Both
foreach my $i (0 .. @array - 1) {...}
and
foreach my $i (0 .. $#array) {...}
feel artificial, and Perl specific to me. And they both have their ugliness (either -1 or $#array).