Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How to create a hash from string

by 2teez (Priest)
on Aug 09, 2013 at 11:08 UTC ( #1048744=note: print w/ replies, xml ) Need Help??


in reply to How to create a hash from string

Or this:

use warnings; use strict; use Data::Dumper; my %h = map $_ => split/:|,/ => 'x:q,y:u,z:n'; { local $Data::Dumper::Sortkeys = 1; ## Update print Dumper \%h; }
UPDATE:
In the solution, map is not even needed. Without it, you still have your solution.
choroba caught that!

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: How to create a hash from string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2014-08-27 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (239 votes), past polls