next until $. >1;
####
next if $_ = /^done/;
####
next if $_= $_=~/^done/;
####
last if /^done/;
#or
#last if $_=~/^done/;
####
my @contents;
my $header=; # extract the first line
while () {
next unless /\S/; # ignore whitespace only lines.
last if /^done/; # finish when we hit a line starting with 'done'
#chomp; # uncomment if you dont want newlines in contents.
push @contents,$_; # add the line to the buffer
}
####
my @contents;
my $header=; # extract the first line
while () {
next unless /\S/; # ignore whitespace only lines.
if (/^done,(\d+)$/) {
die "Count mismatch in trailer. Got $1 expected @{[scalar @contents]}"
unless $1 == scalar(@contents);
last;
}
#chomp; # uncomment if you dont want newlines in contents.
push @contents,$_; # add the line to the buffer
}