Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

share|improve this answer
Thanks it worked – Guestme Feb 21 '13 at 19:03

Your Answer


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.