Perl: Modify certain line number in text-file

By | 2010-03-12
Just wrote up a small pseudocode for a previous post here.
[sourcecode type="php"]

open (IF, "infile.txt");
open (OF, "outfile.txt");
  while (my $line = <IF>) {
    if ($count == 10) {
      # Modify
      print OF "somethingelse\r\n";
    } else {
      # Don't modify
      print OF $line;


Leave a Reply

Your email address will not be published. Required fields are marked *