tamaguchi has asked for the wisdom of the Perl Monks concerning the following question:
%hash=('A'=>1, 'B'=>2, 'C'=>3, 'D'=>4);
@keyarr=(keys (%hash)); foreach (@keyarr) {print hash{$_}=>$_;
foreach $key (sort (keys (%hash))) {print "$key => $hash{$key}\n";}
Edited by planetscape - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing hash
by mbeast (Beadle) on Feb 13, 2006 at 02:42 UTC | |
|
Re: Printing hash
by helphand (Pilgrim) on Feb 13, 2006 at 02:29 UTC | |
by bobf (Monsignor) on Feb 13, 2006 at 02:37 UTC | |
by CountOrlok (Friar) on Feb 13, 2006 at 05:37 UTC |