in reply to Re: Problem generating a hashtable
in thread Problem generating a hashtable

The version of Perl I'm using is ... 5.005 :/
I'd rather work on a 5.8, it you asked me, but I don't have the choice :(

Replies are listed 'Best First'.
Re^3: Problem generating a hashtable
by holli (Abbot) on May 13, 2005 at 13:40 UTC
    What's the output when you run my code above?


    holli, /regexed monk/
      With
      use strict; my %hash = map { (split /:/, $_ )[0] => (split /:/, $_ )[2] } <DATA>; print join ",", sort keys %hash; #key1,key2 __DATA__ key1:useless:value1 key2:useless:value2
      I get :
      key1,key2
      The thing is, I do the same thing as your code in mine, two times : the first time, with a first array given to the map function, it works fine ; but the second time, with another array, it "inverts" the keys and the values.