in reply to Re: [perlre] using qr - help needed
in thread [perlre] using qr - help needed

Because qr compiles the regex it makes the /o modifier rather superfluous. It does however apply to situations where you have a match which has a variable in it and you only want it to be compiled once e.g
my $match = shift @ARGV; my @matched = grep /^$match$/o, <>;
So there the regex will only be compiled once instead for each iteration within the grep. See the perlop|perlop manpage for more info.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re^3: [perlre] using qr - help needed
by Aristotle (Chancellor) on Nov 08, 2002 at 19:01 UTC
    That can be done with qr// as well though.
    my $rx = qr/^@{[shift @ARGV]}$/; my @match = grep /$rx/, <>;
    qr// also is much less likely to be used mistakenly than /o and much easier to spot when it is. /o should be considered a relic from pre-qr// times that has few if any uses anymore.

    Makeshifts last the longest.