my $x=0; for (my$a=0; $a<10; $a++) { open (file); # Read the column headers my $line = ; print $header, "\n"; my @keys = split /\t/, $line; # Process the data while ($line = ) { # The stuff inside the original else clause *Does some filtering as each line is read in* } }