use warnings; use strict; my $search = "Bus(Mini)\n"; while () { if ( ! /$search/ ) { print "No Match found\n"; next; } else { print "Found $search in main file\n"; } } __DATA__ TestFile: Bus Bus(Mini) Car Van