Jan 9, 2000, 10:11 PM
Post #2 of 3
Actually, you can also use the first example you wrote on Win32:
$path = "/home/www/blah";
From "Learning Perl on Win32 Systems" Chapter 10.3 - Using Pathnames and Filenames:
"The only portable delimiter is the slash. Of course, if you're using drive letters, your script isn't really portable anyway.
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>
"c:\\temp" # backslash (escaped for double quoted string)
'c:\temp' # backslash (single quoted string)
"c:/temp" # slash - no escape needed </pre><HR></BLOCKQUOTE>
There are a couple of tradeoffs associated with either approach. First we look at the backslash: if you use the backslash to delimit paths, you have compatibilty problems with scripts that need to run on UNIX systems. You also need to remember to escape the backslash inside of double-quoted strings (or use single-quoted strings, because they are not interpolated). Finally, you need to remember to use a slash if you're outputting URL paths."
If you're going to be working on Win32, you may wish to pick up this book:
Learning Perl on Win32 Systems
By Randal L. Schwartz, Erik Olson & Tom Christiansen
1-56592-324-3, 306 pages
First Edition, August 1997