in reply to Numbering instances of a String in a file

wait first two people to answer, i'm confused. Where do you specify the filename?
  • Comment on Re: Numbering instances of a String in a file

Replies are listed 'Best First'.
Re^2: Numbering instances of a String in a file
by Anonymous Monk on Jun 07, 2010 at 18:51 UTC
    The perl community has a strong unix tradition. The programs above are written as filters and can be called on the command line as:

    perl mycode.pl < inputfile > outputfile
    or
    cat inputfile | perl mycode.pl > outputfile
    etc....
      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