How about just Re::re($str) instead? Or maybe $str =~ /$Re::h{re}/g
Without the /g you would have been able to use $str =~ Re::re(). But to have the global search I can only think of $str =~ /@{[ Re::re() ]}/g or /(??{ Re::re() })/g which aren't much of an improvement.
Can your subs have parameters? If there is one regex for each sub, where the name of the sub is also the key in the hash, you maybe be interested in AUTOLOAD.
Edit: choroba made me realize it's (??{ }) not (?{{ }}) (which should have been obvious, as the latter is actually a case of (?{ }))
In reply to Re: Use function as a regex
by Eily
in thread Use function as a regex
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |