bless$self=>perlmonks; has asked for the wisdom of the Perl Monks concerning the following question:
and this appears to work. My only question is this: Am I truely saving CPU time by doing this, or does perl still have to do something special to turn that string I got from a file into a regular expression.$re = qr/$foo/; print FILE $re, "\n"; # ... and at a later time ... $re = <FILE> chomp $re; if($line =~ /$re/) { # blah blah blah....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: precompiling regexes
by japhy (Canon) on Aug 31, 2001 at 05:52 UTC |