my $in_file = "bill"; my $out_file = "far2"; open IF, "$in_file" or die $!; open OF, ">$out_file" or die $!; while() { chomp; print OF $_; if($. == 4012) { print OF "... test"; } print OF "\n"; } print "Done\n"; close(IF); close(OF);