What's the output when you run my code above?
| [reply] [Watch: Dir/Any] |
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. | [reply] [Watch: Dir/Any] [d/l] [select] |