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

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

by LanX (Archbishop)
on Feb 18, 2015 at 01:39 UTC ( #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
Node Status?
node history
Node Type: note [id://1117060]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2019-10-19 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?