Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Risks in the oblivious use of qr//

by gmax (Abbot)
on Aug 10, 2003 at 16:48 UTC ( #282650=note: print w/replies, xml ) Need Help??


in reply to Re: qr// hidden risks
in thread Risks in the oblivious use of qr//

but isn't this sort of obvious?

Well, this is the whole point. It could not be ovbious for everyone. What is not clearly explained is that qr// will unset the modifiers that we haven't explicitly set.

I didn't mean to rewrite the Bible :), but just to warn against something that may not be immediately perceived. The problem only exists when you embed a pre-compiled regex within a larger expression.

 _  _ _  _  
(_|| | |(_|><
 _|   
  • Comment on Re: Re: Risks in the oblivious use of qr//

Replies are listed 'Best First'.
Re: Re: Re: qr// hidden risks
by hossman (Prior) on Aug 10, 2003 at 17:10 UTC

    Well, people should read documentation. If you see "qr" and don't understand what it does, the first thing you should do is read the docs -- don't just assume you know how it works.

    From perldoc -f qr

           qr/STRING/
    
           qx/STRING/
    
           qw/STRING/
                   Generalized quotes.  See the Regexp Quote-Like
                   Operators entry in the perlop manpage.
    
    

    From perldoc perlop

           qr/STRING/imosx
                   This operators quotes--and compiles--its STRING as
                   a regular expression.  STRING is interpolated the
                   same way as PATTERN in `m/PATTERN/'.  If "'" is
                   used as the delimiter, no interpolation is done.
                   Returns a Perl value which may be used instead of
                   the corresponding `/STRING/imosx' expression.
    
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://282650]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2022-12-03 23:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?