use strict; use warnings; use Tie::IxHash; tie my %where, 'Tie::IxHash'; %where = ( Gary => "Dallas", Lucy => "Exeter", Ian => "Reading", Samantha => "Oregon" ); for ( keys %where ) { print "$_ lives in $where{$_}\n"; }
This is a FAQ:
perldoc -q hash
How can I make my hash remember the order I put elements into it?
To neaten up your code, see perltidy
In reply to Re: Hash error
by toolic
in thread Hash error
by satzbu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |