in reply to Re^2: A question of perlish elegance on array loop
in thread A question of perlish elegance on array loop

If you really need the index, I find it much nicer to just keep a separate index variable.

my $idx = 0; foreach my $thing( @{$object_ref->{array_ref}} ) { # do stuff with $thing $idx++; }