# This could be loaded from a file, a db, whatever. $uncompiled_regexp = 'a.*b'; $text =~ /$uncompiled_regexp/; # If you plan on using the regexp many times, compile it! $compiled_regexp = qr/$uncompiled_regexp/; $text =~ $compiled_regexp;
I like to omit the // for compiled regexp and leave them in for uncompiled regexps, but they are allowed and optional in both cases.
In reply to Re: Load regex
by ikegami
in thread Load regex
by Otogi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |