bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monasterians:
I know how to find the size of an array: $# or $#$, but what if it's part of something like this:
$self->session->param('item' => [ 'indiv_conf', 'organ_conf', 'comp_co +nf' ] );
I want to iterate over each of the 3 elements in the array associated with 'item', but not sure how. Something like:
for ( 0..$#$self->session->param('item')) { print $self->session->param('item')->[$_].'\n'; }
But we know that's not right. Comments?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding size of an array in an HoA
by shmem (Chancellor) on May 15, 2007 at 07:37 UTC | |
by bradcathey (Prior) on May 15, 2007 at 08:17 UTC | |
|
Re: Finding size of an array in an HoA
by Fletch (Bishop) on May 15, 2007 at 12:47 UTC | |
|
Re: Finding size of an array in an HoA
by Moron (Curate) on May 15, 2007 at 09:13 UTC | |
by shmem (Chancellor) on May 15, 2007 at 13:10 UTC | |
by Moron (Curate) on May 15, 2007 at 14:20 UTC | |
|
Re: Finding size of an array in an HoA
by Anonymous Monk on May 15, 2007 at 09:47 UTC |