Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: UNC vs. standard Perl functions

by ikegami (Patriarch)
on Mar 16, 2005 at 14:55 UTC ( [id://439966]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://439966]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found