in reply to Re: Array of hashes reference problem
in thread Array of hashes reference problem
our @arrayAoH = ""; my $i = 0; # i holds the line number of the input (@discovered) ar +ray. my $j = 0; # j holds the number of the table row. my $key; my $value; # $# returns the subscript of the last element in the array. until ($i eq $#discovered){ if ($discovered[$i] =~ m/Item Number:/){ # parse this line containing labels and values until a blank line is f +ound until ($discovered[$i] eq ""){ ($key, $value) = split /:\s*/, $discovered[$i]; ## $arrayAoH[$j] = { $key => $value }; $arrayAoH[$j]{$key} = $value; $i++; } # If the selected item shouldn't be processed, remove this array row. if (($arrayAoH[$j]{"Model Number"} !~ m/^Foo/)){ splice (@arrayAoH, $j, 1); } else { $j++; } } else { $i++;} }
20050623 Edit by ysth: code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Array of hashes reference problem
by rev_1318 (Chaplain) on Jun 22, 2005 at 18:15 UTC | |
by tlemons (Novice) on Jun 22, 2005 at 18:30 UTC | |
|
Re^3: Array of hashes reference problem
by Errto (Vicar) on Jun 23, 2005 at 03:06 UTC |