http://www.perlmonks.org?node_id=910317


in reply to Re: Precompiling substitution regex
in thread Precompiling substitution regex

Thanks. Does the second sample pre-compile the regexes?

Replies are listed 'Best First'.
Re^3: Precompiling substitution regex
by wind (Priest) on Jun 18, 2011 at 20:45 UTC

    I believe that we're mixing terminology here, as "pre-compile" isn't exactly what you're wanting to ask. Yes, the code is only compiled once and after that point it will not need to be recompiled.

    I've used this type of mechanism to program configurable filters. Letting a user edit a config file where they specify anonymous subs like that which are later eval'd and used in my larger package.