my @tokens = split /\t+/; # split on one or more consecutive tabs
####
elsif ((scalar @tokens) == 6) { # if there are 6 fields (and 3 are empty)
####
use strict;
use warnings;
my @comp;
# open FH in some suitable way...
while() {
s/^\s+//;
s/\s+$//;
my @flds = split( / *\t */ ); # tabs might have spaces around them
if ( @flds == 5 ) { # presumably first line of pair
warn "Input line $. replaces previous first-line data: @comp\n" if ( @comp );
@comp = @flds;
}
elsif ( @flds == 6 and $flds[5] =~ /number=(\d+)/
and $flds[0].$flds[1] eq $comp[0].$comp[1] ) {
push @comp, $1;
print join( "\t", @comp ), "\n";
@comp = ();
}
else {
warn "Input line $. ignored: $_\n";
}
}