Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Problem generating a hashtable

by Tomtom (Scribe)
on May 13, 2005 at 13:38 UTC ( [id://456738]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://456738]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-03-28 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found