Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
There's more than one way to do things
 
PerlMonks  

Re: building a hash from regex matches

by NetWallah (Monsignor)
on May 12, 2012 at 04:11 UTC ( #970130=note: print w/ replies, xml ) Need Help??


in reply to building a hash from regex matches

Not any more efficient, but can be written as a single line:

my %data2= map {/^(\w+).*?sum\s+([0-9.]+)/} @lines;

             I hope life isn't a big joke, because I don't get it.
                   -SNL


Comment on Re: building a hash from regex matches
Download Code
Re^2: building a hash from regex matches
by jwkrahn (Monsignor) on May 12, 2012 at 05:43 UTC

    Also as:

    my %data2 = "@lines" =~ /^(\w+).*?sum\s+([0-9.]+)/mg;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-04-21 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls