Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Using a regex as a hash key

by ikegami (Patriarch)
on Jun 06, 2007 at 17:12 UTC ( [id://619631]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Using a regex as a hash key
in thread Using a regex as a hash key

Sorry, it sounds like I needed to be more explicit.

%functions is a Tie::RegexpHash, so your suggestion of $functions{$regex}->($var2); is wrong — Use a normal has for that — and a step in the wrong direction. The key for lookups should not be a regexp, but a value to match against the existing keys.

Looping over all the keys is even worse. The whole point of Tie::RegexpHash is to save you from doing that.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-03-28 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found