in reply to Re^2: Hash in Perl
in thread Hash in Perl
... we declare all values in hash ...
Declare them as what? As Anonymous Monk pointed out above, the data you show is not a hash, it’s a list (of strings). Since you said this data is in a hash, I made a guess as to how the hash was contstructed. A hash is a collection of key/value pairs. Every key must have a value (and every value must belong to a key). I assumed that the data was stored as hash keys, so I supplied an undef value for each — but that could have been any value, as it isn’t used.
If your hash is really key/value pairs of the form: Chicago => 'USA' (another guess), adapting the answer I gave above should be quite straightforward.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Hash in Perl
by rammohan (Acolyte) on Jan 02, 2014 at 06:59 UTC | |
by Anonymous Monk on Jan 02, 2014 at 07:17 UTC |