Sometimes the best way to test for the existence of the directory is to go ahead and see if you can open it. If you want to know if it exists, you may want to look at something in it, so just go ahead and see if you can. It's the ultimate test.
#! /usr/bin/perl -w use strict; for my $dir( @ARGV ) { if( opendir( D, $dir )) { print "$dir: yup\n"; closedir D; } else { print "$dir: nope\n"; } }
- another intruder with the mooring of the heat of the Perl
In reply to Re: Test the existance of a directory (open it)
by grinder
in thread Test the existance of a directory
by gitarwmn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |