open (my $fh,"<",$file) or die "Can't open file $file: $!"; while (my $line = <$fh>) { if($line !~ m/^Processor.*/){ #process only lines which not the ones starting with "Processor" #(...) } }