Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Parsing a Simple Log File

by monarch (Priest)
on Nov 04, 2008 at 23:59 UTC ( [id://721535]=note: print w/replies, xml ) Need Help??


in reply to Parsing a Simple Log File

You have two problems. First, when you capture title you're attempting to capture non-digits (e.g. /(\D+)/). The trouble is that whitespace also qualifies as non-digits. So you're creating empty titles from time to time, which explains the funny whitespace when printing out the blank keys. Try instead to capture only what you're looking for, i.e. characters that aren't digits, or /([A-Za-z]+)/.

Second you're printing out the hash, but really you want to map over the keys of the hash. Add the keyword keys in front of the hash to get the desired result, otherwise the map iterates over key, value, key, value, etc..

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-23 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found