Assignment #8


Now that you really know how to use use Perl and do stuff with files and regular expressions we should do an assignment that is a bit more significant. What I want you to do is to write a script that will do a search and replace on all the files in a specified directory. The user will provide the directory, a regular expression to find, and the text to replace it with on the command line. The original files should be moved to a backup and the modified versions should have the original names.

So an invocation of this might look like this "replace.pl . fred barney". This simple example doesn't use the regular expression capabilities though your program should be able to do that. Technically this specification prevents you from using the shortcut described in the last chapter of the book because I want you to have to do a bit more of the file manuipulation stuff yourself instead of through the magic of the diamond operator.