Salute to the wiser monks!
Being a humble apprentice I have come to discover and start using this:
$#{@{$object_ref->{array_ref}}}
In order to do this:
foreach(0..$#{@{$object_ref->{array_ref}}}){
# I need the index!
}
Which I think is more elegant than this:
for(my $i=0;$i < scalar(@{$object_ref->{array_ref});$i++){
# I need the index!
}
Is there any shortcut or other way for:
$#{@{ ?
I suspect there is, because after greping through my cpan build directory I have not been able to find references to anyone using it, so I guess I must be doing something wrong or terribly awkward! And I have a pretty big .cpan/build directory :)
Thank you in advance!
Alejandro