in reply to Re: Finding size of an array in an HoA
in thread Finding size of an array in an HoA
# typo here ------v :-) for ( 0..$#{$self->session->param('item'}} ) { print $self->session->param('item')->[$_]."\n"; }
means that you have as many calls to session->param as there are elements in the referenced array (apart from the first to get its last index). While impact on speed and program size is minimal, it feels somehow convoluted; taking a reference and iterating over that is cheaper and feels cleaner.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Finding size of an array in an HoA
by Moron (Curate) on May 15, 2007 at 14:20 UTC |