Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: A refactoring trap ( regex /x modifier activates new metacharacters)

by LanX (Saint)
on Feb 18, 2015 at 01:39 UTC ( [id://1117060]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<135> $a='#x'
     => "#x"
    ...
    
      DB<137> "x#x#x" =~ s/$a$a/-/xr  #oops
     => "-x#x#x"
    
  2. or download this
      DB<138> $a=qr/#x/
     => qr/#x/
    ...
    
      DB<140> "x#x#x" =~ s/$a$a/-/xr
     => "x-"
    
  3. or download this
      DB<144> $a='\#x'           # or ='[#]x' 
     => "\\#x"
    ...
    
      DB<146> "x#x#x" =~ s/$a$a/-/xr
     => "x-"
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found