Ing. Branislav Gerzo wrote:
Hi pals,
Hello,
I have simple hash question, lets we have example code:
my %hash = ( 1 => 2, 2 => 3, 3 => 4, 4 => 5 );
while (my($key, $value) = each(%hash)) { print "$key => $value\n"; }
how I can print all values, if I want print that in this order:
2 => 3
4 => 5
3 => 4
1 => 2
You could store the keys you want in the order you want in an array.
my @keys = ( 2, 4, 3, 1 );
print "$_ => $hash{$_}\n" for @keys;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>