Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Checking for valid directory

by cbro (Pilgrim)
on Jul 03, 2003 at 15:24 UTC ( #271198=note: print w/ replies, xml ) Need Help??


in reply to Checking for valid directory

I'm not sure why you have the single backslash in your directory name, but if you are using Windows then you need to escape the slash, (e.g. my $dir = "\\TestDir";).

Either way, don't use backslashes. This way you don't have to worry about escaping them. Here's an example (I'm assuming your using windows because of your $dir definition):

my $dir = "c:/docume~1/chris/TestDir"; if (-d $dir) { print "It Exists"; } else { print "Does Not Exist"; }

So, the first method you tried...the one w/out $dir in quotes should have worked. Try making $dir an absolute path, and use forward slashes. See if that makes a difference.
HTH,
Chris


Comment on Re: Checking for valid directory
Select or Download Code
Re: Re: Checking for valid directory
by Anonymous Monk on Jul 03, 2003 at 15:44 UTC
    Sorry folks, I had the output going to stderr so that is why I didnt see the output. Again, sorry to not catch this before I posted!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-07-23 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (131 votes), past polls