Perl: the Markov chain saw | |
PerlMonks |
Re^4: Using a regex as a hash keyby ikegami (Patriarch) |
on Jun 06, 2007 at 17:12 UTC ( [id://619631]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|