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++; }
In reply to Re^3: A question of perlish elegance on array loop
by friedo
in thread A question of perlish elegance on array loop
by ait
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |