in reply to Perl Command Help

In addition to the previous comments, Perl can be used like sed to edit files on the fly if ran with the -i switch (often used with -p) in the command line or the hashbang line.

If you write your program for -i and -p switches, all your code needs to do is to change the $_ variable which equals to the current line of the file being edited (the code is re-ran on each line sequentially). Read perlrun for more information on this topic.