my @temp; my $count; my $header; my $label; unless (open DATA, "; @temp = split /\t/, $header; $label = $temp[0]; unless (open OUTPUT, ">$label.xls") { die "Cannot open $label.xls: $! "; } print OUTPUT "$header"; while () { chomp; @temp = split /\t/, $_; $count = 0; if (@temp[1] =~ P) { $count++; } if (@temp[2] =~ P) { $count++; } if (@temp[3] =~ P) { $count++; } if ($count > 2) { $_ = join(' ', @temp); print OUTPUT "$_\n"; } print "."; } close OUTPUT; close DATA;