Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Can a hash name have the same value twice.

by Roger (Parson)
on Sep 10, 2003 at 03:59 UTC ( [id://290290]=note: print w/replies, xml ) Need Help??


in reply to Can a hash name have the same value twice.

Create a two dimensional hash like this:
@cities = qw/ US:Miami AU:Melbourne US:Chicago /; map {my($co,$ci)=split/:/,$_; $n{$co}{$ci}=1 } @cities; foreach $x (sort keys %n) { foreach (sort keys %{$n{$x}}) { printf "$x - $_\n"; } }
Which will print out:

AU - Melbourne
US - Chicago
US - Miami

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://290290]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-24 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found