in reply to Load regex

# 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.