in reply to Re: Precompiling qr/.../o question
in thread Precompiling qr/.../o question
for ( 1 .. 5 ) { $foo = qr/$_/o; print "Match!\n" if '1' =~ m/$foo/; }
and
for ( 1 .. 5 ) { $foo = qr/$_/; print "Match!\n" if '1' =~ m/$foo/; }
print entirely different outputs on perl 5.8.8 for me.
Further, the reference in perlop for qr lists this usage:
qr/STRING/msixpo
The 'o' is listed as meaning "Compile pattern only once.".
perlop does go on to say that if the compiled regex is embedded in a larger pattern that 'o', unlike the other options, will not propagate out to the other parts of the regex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Precompiling qr/.../o question
by hardburn (Abbot) on Apr 02, 2008 at 19:11 UTC | |
by mr_mischief (Monsignor) on Apr 02, 2008 at 21:52 UTC | |
|
Re^3: Precompiling qr/.../o question
by ack (Deacon) on Apr 04, 2008 at 17:21 UTC | |
by mr_mischief (Monsignor) on Apr 04, 2008 at 17:31 UTC | |
by ack (Deacon) on Apr 08, 2008 at 03:52 UTC | |
by ikegami (Patriarch) on Apr 08, 2008 at 04:13 UTC |