in reply to Re: precompiling regular expressions
in thread precompiling regular expressions
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: precompiling regular expressions
by ikegami (Patriarch) on Oct 22, 2010 at 10:34 UTC |