$file2 = param('file'); # A windows path is supposed to be filled here (c:/foo/bar.txt) print "$file2\n"; # c:foobar.txt is printed $file2 =~ s[\\][/]g; # It's too late to substitute.