use strict; use warnings; my $line = "test_scores.txt"; open(FH, $line) or die "Cannot open $line"; readline(FH); #<-- read the first line effectively skipping it while($line=){ if ($line=~m/^C/) { print($line); } }