in reply to Re^2: replacing backward slash with forward slash
in thread replacing backward slash with forward slash
The double quotes interpolate and the single quotes don't. What that means is that in your code, perl is treating the backslashes as an escape character. To avoid that you either need to escape the backslash in double quotes or just use single quotes. The two variables below will have the same string.
$str1 = "C:\\first\\second"; $str2 = 'C:\first\second';
On another system, a string is declared in double quotes and is printing fine.
Are you sure that you have the exact some perl code on both systems? Personally I can't think of any reason why perl would behave differently with regards to double quoting a string across different versions of perl or across different platforms. If I'm wrong about that, guess I'll have something new to learn.
|
|---|