Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://271198]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-01-17 09:54 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (198 votes). Check out past polls.