in reply to UNC vs. standard Perl functions

>perl -e "print '\\server\share'" \server\share

Don't you mean

>perl -e "print '\\\\server\\share'" \\server\share >perl -e "print -d '\\\\server\\share'" 1

Remember,
\ and ' must be espcaped with \ in single-quoted string literals.
\ and ", $ and @ must be espcaped with \ in double-quoted string literals.

Replies are listed 'Best First'.
Re^2: UNC vs. standard Perl functions
by Errto (Vicar) on Mar 16, 2005 at 15:05 UTC
    Actually, double-\\ in a single-quoted string is interpreted as a single \ but otherwise \ does not need to be escaped. So this also works:
    perl -e "print -d '\\\\server\share'"

      True. Stylisticly, I prefer to escape them all, so I don't have to look at the context to know what \n means (for example). Adopting that convention would have avoided the OP's problem.

Re^2: UNC vs. standard Perl functions
by crenz (Priest) on Mar 16, 2005 at 14:59 UTC

    I'm hitting myself now. Thanks, I forgot about that. I was so very convinced you don't have to quote \ in '' strings...

      You don't, unless you want to have two of them together.