in reply to Re: Re: Perl - Read a file on another server
in thread Perl - Read a file on another server

$file = '//Server2/f$/logconn.txt';
and
$file = '\\Server2\f$\logconn.txt';

are equivalent.

(I removed the "l" typo)
Try this:

print '//Server2/f$/logconn.txt', $/; print '\\Server2\f$\logconn.txt', $/;
and you'll see
//Server2/f$/logconn.txt \Server2\f$\logconn.txt
Use that second one as a file path and Server2 won't even be bothered.

This is why I always double \ in Perl quoted strings (except for "here documents" which is the one form of quoting in Perl that doesn't treat \ as special) and so would write the second one as: '\\\\Server2\\f$\\logconn.txt' even when using single quotes. Otherwise you get in the habit of thinking that \ isn't special in single quotes and make the mistake you just did (which can be real hard to debug when you do it).

P.S. Note that / doesn't work as a directory separator when you pass file names as command-line arguments to many Win32 commands. I believe that this is the only exception (well, other than some GUI tools don't allow them either, but most people rarely use Perl to stuff strings into a GUI [though I've done that]).

        - tye (but my friends call me "Tye")