Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Now I need to count how many types of products I have by ref, (eg. 'ref261' has 4 type of products), which is my problem, so far I have thisfor my $index2 (0..$#productarray) { $Prod{$reference}->{$productarray[$index2]}++; } Output: 'ref261' => { 'rope' => '4', 'suit' => '1', 'boats' => '3', 'Gloucestershire' => '1', }, 'ref523' => { 'pool' => '2', 'fish' => '1', 'polystyrene' => '1', },
mmmmmmh I really don’t know what am I doing!!, even I read different material, post about hashes.foreach my $ref (keys %Prod){ my $hash_ref = $results{$ref}; foreach my $ofHash ($hash_ref){ $totaltype{$ofHash}++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Count values of the inner hash?
by Limbic~Region (Chancellor) on Mar 28, 2004 at 02:35 UTC | |
by Roger (Parson) on Mar 28, 2004 at 03:01 UTC | |
by bart (Canon) on Mar 28, 2004 at 11:21 UTC |