foreach my $line (@lines) { next if $line =~ /^QKC_/; #do something with $line }