fionbarr has asked for the wisdom of the Perl Monks concerning the following question:
for ( 0 .. ( $offense_line_count - 1 ) ) { my $value = $offense_value_array[$_]; # next if ( !defined $value ); my $label = $offense_label_array[$_]; $title = $value if ( $label eq 'Title'); $section = $value if ( $label eq 'Section' ); $subsection = $value if ( $label eq 'Subsection' ); $class = $value if ( $label eq 'Class' ); $category = $value if ( $label eq 'Category' ); $degree = $value if ( $label eq 'Degree' ); $num_chgs = $value if ( $label eq 'CountOfCharges'); $hash{$label} = $value; print "$hash{$label}\n"; if ( $label eq 'CountOfCharges') { for (0 .. ($num_chgs - 1)) { push (@AOH, %hash); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: accessing elements in array of hashes
by johngg (Canon) on Jun 27, 2013 at 19:18 UTC | |
|
Re: accessing elements in array of hashes
by Eily (Monsignor) on Jun 27, 2013 at 18:15 UTC | |
|
Re: accessing elements in array of hashes
by fionbarr (Friar) on Jun 27, 2013 at 18:09 UTC | |
by ww (Archbishop) on Jun 27, 2013 at 18:18 UTC |