in reply to Re: hash of hashes
in thread hash of hashes
Why on earth would you want to do that?You'd want to do that in perl if the original input contains duplicates and you only want to show unique license plate numbers. Since perl doesn't have a built-in concept of a (uniqe) set hashes are the natural structure to use.
To the OP: note that i use sort here, but that's just because I presume you'd want the output to be predictable.
Updated: removed map() - code should now be correct$plates{$lets}{$number} =1; # or $plates{$lets}{$number}++ if you wan +t to count # and for my $let (sort keys %plates) { print "$let ",join(", ",sort keys %{$plates{$let}}),"\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: hash of hashes
by volcan (Novice) on Mar 23, 2007 at 22:08 UTC | |
|
Re^3: hash of hashes
by Anno (Deacon) on Mar 24, 2007 at 08:05 UTC | |
by volcan (Novice) on Mar 25, 2007 at 19:59 UTC |