Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: problem in substitution

by ccn (Vicar)
on Dec 08, 2008 at 07:31 UTC ( [id://728873]=note: print w/replies, xml ) Need Help??


in reply to problem in substitution

($file2 = $file1) =~ s/\Q$dir1/$dir2/;

Since you have backslahes inside of the pattern you need use \Q to disable pattern metacharacters.

Also you don't need any modifiers (esg) for the regexp, excepting i probably.

see perldoc perlre

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found