in reply to Re^3: Search and replace within a file
in thread Search and replace within a file

Hi

Yes that’s correct $uname is not being replaced. If I remove the $uname and place for example XXXXXXX within the code and also place this into the /etc/hosts file it does replace it. Its only when I use the scalar $uname it doesn’t seem to work.

s/XXXXXXX/$answer1/g;

As suggested I’ll give quotemeta a go and see if that works. Thanks for your help with this anyway