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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to