in reply to Numbering instances of a String in a file
perl mycode.pl < inputfile > outputfile [download]
cat inputfile | perl mycode.pl > outputfile [download]
perl mycode.pl inputfile > outputfile [download]