in reply to A question of perlish elegance on array loop

Perl will use scalar context when it expects a scalar. @ary in scalar context is the number of elements so $#ary and @ary-1 are the same. This is perhaps a little more elegant.

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