Adriano Allora wrote at Tue, 25 Mar 2003 15:39:14 -0800:

> hello,
> I need to delete single lines in a text (for example the 132nd, the 133rd and the 
> 134th ones).
> How can I do it in a structure like:
> 
> if $. = selected number
>             line = ""
> 

As TMTWTDI, here's another one:

while (<>) {
    print if (1 .. 131) || (135 .. -1);
}


However, for such jobs, it's also often a good idea to use the Tie::File
module, where you could use a splice to delete the lines, e.g.
[untested]

tie my @line, 'Tie::File', $filename or die " ... ";
splice @line, 131, 3;     # Note that the 132nd line has index 131


Best Wishes,
Janek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to