in reply to Deleting first and last TWO(2) lines of a text file
Today's coding warm-up using Path::Class
use Path::Class qw{ file }; # # Getting file name is left to reader # my $input_file = file( $filename ); # # WARNING: Destructive operation! # my $output_file = $input_file; # Left to the reader to change my @file_contents = $input_file->slurp(); shift @file_contents; # Remove first line pop @file_contents; # Remove last line $output_file->spew( @file_contents );
|
---|