Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^5: Help understand why this grep does not work

by drmrgd (Beadle)
on Nov 02, 2013 at 16:46 UTC ( #1060958=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Help understand why this grep does not work
in thread Help understand why this grep does not work

Yes, this is why I didn't do that in the first place. Although with the data I have listed I think this would work, if I had to expand it and there weren't unique values, you're right - this wouldn't work so well. I think your 'or-ed regex' is indeed better.

For the sake of argument (I'm just playing around trying to get better a handling data in Perl and the map function), what's the best way to create a hash of arrays with this data? I can't seem to create the data structure with a map. I know this won't work as it overwrites the values on each pass:

my %data_hash = map { /^(\w\s+\d)/ => [$_] } @data2;

But, I can't seem to figure out how to create a hash of arrays with the map function. Maybe it's not possible or not the best way?


Server Error (Error ID 7394767a76342)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2015-03-29 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (632 votes), past polls