$_ = ; while (defined($_) && ($_ =~ /^(\S+)\t\S+\t(\S.*\S)/)) { $curr = $1; $func = $2; $ok = 1; @set = (); while ($_ && ($_ =~ /^(\S+)\t\S+\t(\S.*\S)/) && ($1 eq $curr)) { if ($2 ne $func) { $ok = 0; } push(@set,$_); $_ = ; } if ($ok) { print join("",@set); } else { print STDERR join("",@set); } }