Re: swap keys and values

2012-03-21 Thread lina
On Wed, Mar 21, 2012 at 9:04 PM, Mendor 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.

Re: swap keys and values

2012-03-21 Thread Shlomi Fish
ׁHi Lina, On Wed, 21 Mar 2012 21:00:53 +0800 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" > ); > > forea

Re: swap keys and values

2012-03-21 Thread Mendor
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" );