Perl: How do I remove the first line of a file without reading and copying whole file

前端 未结 6 1249
刺人心
刺人心 2021-01-01 19:06

I do have a whole bunch of files in a directory and from every file I want to remove the first line (including carriage return). I can read the whole file into an array of s

6条回答
  •  北海茫月
    2021-01-01 19:43

    use Tie::File qw();
    for my $filename (glob 'some_where/some_files*') {
        tie my @file, 'Tie::File', $filename or die "Could not open $filename: $!";
        shift @file;
    }
    

提交回复
热议问题