Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Putting an array into a hash

by Zaxo (Archbishop)
on Dec 10, 2004 at 06:09 UTC ( [id://413763]=note: print w/replies, xml ) Need Help??


in reply to Putting an array into a hash

This should do the job, %data = map {/(\w+)\s*(\w+)/} @info; That will key the hash with the first word and place the next word as value. You may want to replace that with split ' ', $_, 2, so that punctuation in the data or multi-word values don't give mangled results. For instance, in your data, your regex will cut off the email address at the @ sign.

%data = map {split ' ', $_, 2} @info;

After Compline,
Zaxo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-16 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found