Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Regex random values pattern match and code efficiency

by hdb (Monsignor)
on Sep 12, 2013 at 18:07 UTC ( [id://1053781]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regex random values pattern match and code efficiency
in thread Regex random values pattern match and code efficiency

Well, I encourage you to run my proposed code on all kinds of test data to see how it fares. You might also try to understand how it works to see that it does not care what exactly there is. As you will see there is no sign of a static mapping.

One thing I would propose is to add a filter for lines without equal sign to make it more robust:

my %h = map {my($k, $v)=/^(.*?)=(.*)/; $v=[ $v=~/{(.+?)}/g ] if $v=~/} +/; $k=>$v } grep {/=/} <DATA>;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-23 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found