title: Perl Regular Expression to match special characters
body: <p>I have the below code in which I am checking for a specific variable location in an array excluded.It works fine with all the array elements except one (abc/def/libraries/linux_3.2.60-1+deb7u3.dsc). When I provide this element as my location its printing "location not excluded" , even though its excluded.</p>
  
  <p>How can I made my code to get this element as well as excluded?</p>
  
  <pre><code>use strict;
  use warnings;
  
  my @excluded = (
   "xyz/efg/headers/",
   "abc/def/libraries/jni-mr.h",
   "abc/def/libraries/linux_3.2.60-1+deb7u3.dsc", 
  );
  
  my $location = "abc/def/libraries/linux_3.2.60-1+deb7u3.dsc";
  my $badpath = 0;
  
  foreach (@excluded) {
      # -- Check if location is contained in excluded array
      if ($location =~ /^$_/) {
         $badpath = 1;
         print "location is excluded : $location \n";
       }
     }
  
     if (! $badpath) {
        print "location is not excluded : $location \n";  
       }
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>location is excluded : abc/def/libraries/linux_3.2.60-1+deb7u3.dsc
  </code></pre>
  
  <p>Current Output:</p>
  
  <pre><code>location is not excluded : abc/def/libraries/linux_3.2.60-1+deb7u3.dsc
  </code></pre>