On a side note, let me recommend you File::Slurp module, it allows you to replace the whole your example with:
use File::Slurp qw(edit_file); edit_file { s/$uname/$answer1/g; s/domainsuffix.net/$answer4/g; } $hosts;
In reply to Re: Search and replace within a file
by zwon
in thread Search and replace within a file
by muizelaar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |