Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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 about the Monastery: (4)
As of 2018-03-24 20:25 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (299 votes). Check out past polls.