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.