First you can use vitually any character you like as the delimiter for regexes so these are all legal:
m#this#;
s!foo!bar!;
s{this}<that>;
m!word/word/word/word!
Thus if you have a lot of / in your match use something else. I use ! personally. Note that you must have the m unless you use // for matching when it is optional.
Next you can escape all the metacharacters without even having to know what they are with quotmeta. There are two versions. The function and the inline regex version:
my $sting = 'all the metachars |+*?(){}-[]^$. ';
$regex_safe = quotemeta $string;
print "We have a match" if m/$regex_safe/;
# alternatively we can use \Q (begin quotemeta) and \E (end qm)
print "We have a match" if m/\Q$string\E/;
# to do what you want perhaps you might use...
m!(?:[\w ]+/){3}[\w ]+!;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|