On Wed, Mar 21, 2012 at 9:04 PM, Mendor <men...@yuuzukiyo.net> wrote:
> You can use reverse() for this, can't you?

Thanks for both of you.

I didn't know the reverse() can do this, and didn't realize how mature
the perl has evolved.

About the $array, before I mistook %h as %array, later writing email I
realize this.

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

--
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