in reply to Re^4: Deleting first and last lines of a text file
in thread Deleting first and last TWO(2) lines of a text file
.. should automate the task of deleting the lines in the file ..
Then, in that case, you can specify the filename in your script, then open a filehandle to read from,doing all you wanted done. Like so:
use warnings; use strict; my $filename = '...'; # specify the file name here open my $fh, '<', $filename or die "can't open $filename: $! "; while ( defined( $_ = <$fh> ) ) { print $_ unless $. == 1 or eof; } close $fh or die "can't close $filename: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Deleting first and last lines of a text file
by vsmeruga (Acolyte) on May 16, 2014 at 13:33 UTC |