Think about Loose Coupling | |
PerlMonks |
Re^4: windows perl and pathsby eyepopslikeamosquito (Archbishop) |
on Nov 20, 2016 at 05:37 UTC ( [id://1176185]=note: print w/replies, xml ) | Need Help?? |
...with respect to the use of forward slashes in windows -- M$ sees the two as equivalent...To be more precise, the Windows API treats forward slashes and back slashes equivalently in file path arguments to all Windows API functions. However, Windows commands typically use forward slash for command line argument options. So, while using forward slashes in file paths is fine when calling Win32 API functions (as the perl C sources do when built for Windows), using them in command line arguments when running Windows commands can be problematic. In my Perl programs on Windows, I use forward slashes in all file paths, which works fine when calling all Perl internal functions. In the rare cases where I need to pass a file path to an external Windows command, I translate it like so: $filepath =~ tr{/}{\\}; See also: forward vs back slash python question. Update: Note that all Win32 API functions have always treated forward slashes and back slashes equivalently in file path arguments. See also Re^2: What is the meaning of this line in Perl on linux? and Re^4: Changing filename extensions.
In Section
Seekers of Perl Wisdom
|
|