said, Perl already performs this optimization if your regex does not contain variables which must be interpolated. Perl compiles the regex into an internal format and stashes it to use during the program. When Perl encounters a variable in a regex it can't be sure that the variable will never change and so it compiles it each time the regex is used. If you, as the programmer know that the variables in the regex will never change, you can use the o option to tell perl that it is okay to compile this regex once and reuse it over and over.