You have
rnahi's answer - it's a shortcut, no offence but I think it's a bit too
magic for your level of perl mastery. Here are my instructions:
- Learn how to open a file handle - perldoc -f open
- Learn how to read the file content - perldoc perlop look for the <> operator.
- Learn Perl regular expressions - perldoc perlre
- Learn the substitution operator perldoc perlop look for s/PATTERN/REPLACEMENT/egimosx
- Learn how to write to a file - perldoc -f print
Then the progarm should be obvious.