prasadbabu has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
i am new to perl
i have a doubt in a hash workings
input: %hash = ("1" => "canada", "1" => "us", "2" => "england", "3" => "france", "3" => "russia");
i need a output as
output:
1 # canada, us
2 # england
3 # france, russia
when i prints $hash{"1"} i am getting the "us" only but i need all the values of the key
is it possible to access all the values of a single key?
if so, please clarify and i need an example.
i think a key can have more than one values.
thanks in advance
Prasad
20040904 Edit by castaway: Changed title from 'hash'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple Values for a Key
by ccn (Vicar) on Sep 02, 2004 at 14:24 UTC | |
|
Re: Multiple Values for a Key
by Limbic~Region (Chancellor) on Sep 02, 2004 at 14:28 UTC | |
|
Re: Multiple Values for a Key
by hardburn (Abbot) on Sep 02, 2004 at 14:28 UTC | |
|
Re: Multiple Values for a Key
by perlfan (Parson) on Sep 02, 2004 at 14:35 UTC | |
by Grygonos (Chaplain) on Sep 02, 2004 at 17:03 UTC |