sundeep has asked for the wisdom of the Perl Monks concerning the following question:
I used the following code to check the hash keys in 2 hashes and print the same occurring hash key and its respective value
while (((my $key1,my $value1)=each(%websites))) { while (((my $key2,my $value2)=each(%newsites))) { if($key1 = $key2) { print "$key2=$value2 \n"; } } }
But, i want to sort the hash keys numerically in both the hash tables and then print the common key and the value . So how can i sort and print it simultaneously
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort and Print Hashes simultaneously
by moritz (Cardinal) on Nov 01, 2010 at 16:42 UTC | |
by sundeep (Acolyte) on Nov 01, 2010 at 16:49 UTC | |
|
Re: Sort and Print Hashes simultaneously
by kennethk (Abbot) on Nov 01, 2010 at 16:47 UTC |