On Wednesday 20 August 2008 15:03:37 Per Jessen wrote:
Anders Johansson wrote:
On Wednesday 20 August 2008 14:40:50 Per Jessen wrote:
Can anyone epxlain to me what the 'o' modifier achieves (or not) in this example:
$copy =~ s/[[:graph:]]+//go;
It means that the regexp engine will precompile the regular expression, and not recompile it every time the line is executed. Described in "man perlop"
So purely a minor performance optimization?
Yes. But (from "man perlop"): This avoids expensive run-time recompilations, and is useful when the value you are interpolating won't change over the life of the script. However, mentioning "/o" constitutes a promise that you won't change the variables in the pattern. If you change them, Perl won't even notice. Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org