Wrap $path in \Q and \E (which escapes metachars) like so...
my $file = 'c:\some\win32\path\mydir\file.txt'; my $path = 'c:\some\win32\path'; (my $file_nopath_noext = $file) =~ s/\Q$path\E\\(.*)\.txt/$1/; print $file_nopath_noext."\n";
See perldoc perlre.
In reply to Re: how to overcome Win32 path delimiter in s///?
by The Mad Hatter
in thread how to overcome Win32 path delimiter in s///?
by bsdz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |