satzbu has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks i want to print hash keys and values without changing the order what can i do for that for example
#!/usr/bin/perl #hash2.plx use warnings; use strict; my %where=( Gary => "Dallas", Lucy => "Exeter", Ian => "Reading", Samantha => "Oregon" ); for (keys %where) { print "$_ lives in $where{$_}\n"; } _OUTPUT_ Samantha lives in Oregon Gary lives in Dallas Lucy lives in Exeter Ian lives in Reading _EXPECTED OUTPUT_ Gary lives in Dallas Lucy lives in Exeter Ian lives in Reading Samantha lives in Oregon
that means i want to print the keys and values without changing the order
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash error
by toolic (Bishop) on Apr 20, 2010 at 17:57 UTC | |
|
Re: Hash error
by ikegami (Patriarch) on Apr 20, 2010 at 17:55 UTC | |
|
Re: Hash error
by almut (Canon) on Apr 20, 2010 at 17:54 UTC | |
|
Re: Hash error
by AR (Friar) on Apr 20, 2010 at 18:03 UTC | |
|
Re: Hash error
by Old_Gray_Bear (Bishop) on Apr 20, 2010 at 20:19 UTC |