Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script where I am reading a file in hash and using one of the values as a search $find = "pqr" and trying to replace with a directory structure $replace = "/abc/xyz/bcd"

/usr/bin/perl -0777 -pi -e 's/$find/$replace/' $file

This doesn't work, I tried using "" quotes - no success

Please let me know if there some quick suggestion

share|improve this question

1 Answer 1

If your $replace contains slashes, use a different separator (and double quotes):

"s%$find%$replace%"
share|improve this answer
    
Thanks it worked –  Guestme Feb 21 '13 at 19:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.