I think you are trying to parse a file path, if so i would recommend you to see a module File::Basename - Parse file paths into directory, filename and suffix.
If you really want regex to match exact word then try something like
use strict;
my $data="Adi";
my $file="$(ROOT)/../../../../adi/../../Audio_Driver/adie_lib/$(CPU)/a
+di" ;
if($file =~ /\b$data\b$/i){ # apply word boundaries by \b
print "match\n";
}
One more thing The \Q tells Perl where to start escaping special characters, and the \E tells it where to stop, and in your given $data variable, i am not finding any special characters so no need to use it.
It would be nice if you also see perlfaq6. |