You don't need the extra @{} In there. Just $#{ $array_ref } is what you want (or $#{ $obj->{ array_ref } } from your example).
Update: And seconded, unless you've got good reason to need the index for my $elem ( @{ $obj->{ array_ref } } ) { ... } is more idiomatic.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: A question of perlish elegance on array loop
by Fletch
in thread A question of perlish elegance on array loop
by ait
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |