Re: [gerble1000] how to rewrite a specific line of a txt file
[In reply to]

Can't Post

No, no, the method with $. works perfectly. But I can't give you the code to change the line since I do not know what change you want to do.

If you just want to replace completely the line 11, then you could have something like this:

Code

my $line_11 = "I have a dream, that my four little children will one day live in a nation where they will not be judged by the color of their skin ...\n"; while ($line = <FILE>) { if ($. == 11) { print OUT $line_11; else print OUT $line; } }