in reply to How do I speed this up?
Another option is to build a regular expression like this:
where "foo", "bar", and "baz" are your constants, the keys in your %constants hash. You'll want to use \Q and \E around each of the constants if they contain any regexp metacharacters.s/(foo|bar|baz)/$constants{$1}/g;
|
|---|