I think it would do more good if you showed us at least a starter script to show somewhat of an effort. If you haven't a small code written up yet, then from your question I suggest that you read up on
perlman:perlre and
File Input and Output.
"Es gibt mehr zu Leben als Bücher, kennen Sie.
Aber nicht viel mehr " -(Der Smiths)