in reply to / to \ substitution

why don't you substitute before printing ?????
$file2 = param('file'); # A windows path is supposed to be filled h +ere (c:/foo/bar.txt) $file2 =~ s%\\%/%g; # It's not too late to substitute here. $file2 =~ s%.*:%%; # also cut off c: print "$file2\n"; # c:foobar.txt is printed
if you need to keep the original value you can do
($file3 = $file2) =~ s%what%ever%g;

Replies are listed 'Best First'.
RE: Re: / to \ substitution
by NeverMore (Acolyte) on Jun 01, 2000 at 05:31 UTC
    First of all, it is still too late to substitute.

    Second, why would I want to cut c: off?

    This solves nothing, I'm still left with an invalid path.

    -NM