#!/usr/bin/perl -w use strict; use warnings; my $folder='FileMuxInternaldefs'; my $mk='./AACBaseFileLib/common.mk: $(PROJECT_ROOT)/../FilemuxInternalDef'; if ($folder =~ /$mk/i) #this match failing for the give input { print "\nIN\n"; if ($folder !~ /$mk/m) { print "CASE-SENSITIVE:$mk\n"; } }