Hello, I have a text file (texst1.txt) that reads:
The quick brown fox jumped over the lazy dog. I would like to replace the word fox with coyote. Is there an easier/simpler/cooler way to do this? #!/usr/bin/perl -w use strict; open (FILE, "test1.txt"); open (NEWFILE, ">>tmp"); while (<FILE>) { if ($_ =~ /fox/) { s/fox/coyote/; } print NEWFILE $_; } close FILE; close NEWFILE; unlink "test1.txt"; rename "tmp", "test1.txt"; Thanks, Greg -- ______________________________________________ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>