You can use reverse() for this, can't you?
--
Regards.
On 21.03.2012 17:00, lina wrote:
Hi,
I tried to write something, but chocked in the end,
Thanks ahead for your advice,
#!/usr/bin/env perl
use strict;
use warnings;
my %h = (
1 => "a",
2 => "b",
3 => "c"
);
foreach my $key ( sort keys %h){
$h{$h{$key}}=$key;
delete $h{$key};
}
foreach my $key (sort keys %h){
print $array{$key},"\n";
}
## here I wish to put the swap in the sub, but don't know how to do it.
sub swap_key_value{
foreach my $_ (sort keys @_){
}
}
Best regards,
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/