open CONT, "zcat $filename|$what"
or die $!;
- while (<CONT>) {last if /^FILE/mo;}
- open CONT, "zcat $filename|$what" if eof(CONT);
+ while (<CONT>) { last if /^FILE/mo; }
+ if (eof(CONT)) { # no header found
+ close CONT; # explicit close to reset $.
+ open CONT, "zcat $filename|$what";
+ }
while (<CONT>) {
my $data = "";
my %data = ();