However, I am perplexed as to why the OP wants to do that in the first place? I write a lot of Perl on Windows and Windows just isn't DOS anymore. Modern Windows is fine with forward slashes. Better than good code is: "no code". I don't see the need to convert forward slashes to back slashes.
Having said that, I do have a vague recollection of some command from the Windows command line where I had to use backslash as part of the path to get the command to work. This may have been a legacy issue with ancient MS code. I have never seen such a requirement when using Perl. It could exist, but I haven't come across it yet.
Anyway, my advice is "don't run a format conversion where it is not necessary".
Update: Clarification: On the command line, Windows will display back slash, but that does not mean that you have to use them:
A Perl program is not getting what Windows displays for its command line.C:\Users\xxx\Documents\PerlProjects> cd C:/Users C:\Users>
In reply to Re^2: What is the meaning of this line in Perl on linux?
by Marshall
in thread What is the meaning of this line in Perl on linux?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |