bsdz has asked for the wisdom of the Perl Monks concerning the following question:
my $file = 'c:/some/win32/path/mydir/file.txt'; my $path = 'c:/some/win32/path'; (my $file_nopath_noext = $file) =~ s/$path\/(.*)\.txt/$1/; print $file_nopath_noext."\n";This works fine but now replace forward slashes in the $file and $path variables to a backslash and it all stops working. How does one stop interpolation on the $path variable in s///? I've tried using (?{$path}) to no avail. I would prefer not to do any variable preprocessing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to overcome Win32 path delimiter in s///?
by The Mad Hatter (Priest) on Oct 14, 2004 at 23:32 UTC | |
by bsdz (Friar) on Oct 14, 2004 at 23:41 UTC | |
by inman (Curate) on Oct 15, 2004 at 09:25 UTC | |
|
Re: how to overcome Win32 path delimiter in s///?
by ikegami (Patriarch) on Oct 15, 2004 at 00:45 UTC |