xerophyte, this is a great place to start with learning perl. The tasks you wish to accomplish can be written (in a well structured manner, I know somebody will think of a one-liner method) in less than two dozen lines. The functions you need to use are very common ones which are well documented in
ANY perl book (
open, if, s///, system, print; to name a few).
However, I don't think anyone on here wants to write your program for you. First, you won't learn nearly as much if we write it for you. Second, only you know the specifics of your requirements. The desired question is one which includes at least a snippet of the code you have tried and any errors it produced. Most of the monks here are happy to help you along, but we do require that you put some real effort into solving the problem.
Finally, please take a shot at this yourself and post any problems you have then. When you re-post, please read this and specifically this first.