in reply to Re^2: Numbering instances of a String in a file
in thread Numbering instances of a String in a file

Oh, and I forgot to mention, by the magic of the "<>" operator, the input file can just be mentioned as an argument to the program:
perl mycode.pl inputfile > outputfile