i did it like this. My script was replacing characters, but it can do more.
sub fixspace{
$rem ="bob";
$rep = "john";
open FILE, "<$file";
open OUTP, ">c:\\joshperl\\deptemp.txt";
while (<FILE>)
{
s/$rem/$rep/go;
print OUTP;
}
close FILE;
close OUTP;
}