for my $i (0..@{$object_ref->{array_ref}}-1) { # $i got the index }