Compiles once (since Perl notices the pattern doesn't change):
sub f { my $pat = $_[0]; (my $str = 'abba') =~ s/$pat//g; } f('b') f('b') f('b')
are you sure about that? basicly I do that, but the profiler claims that CORE:regcomp is called as often as f is executed...
I am using a rather ancient edition of perl (5.8.6), has this behavivour changed since then?
In reply to Re^2: precompiling regular expressions
by Anonymous Monk
in thread precompiling regular expressions
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |