Determining whether direcotry or file
Quote:
> I succefully get a file mode information. And I'd like to check
> the item is whether file or directory.
Do you mean this?
if (-f $filename) {
print "It's a file.\n";
} elsif (-d _) {
print "It's a directory.\n";
} else {
print "It's something odd, like maybe a pipe.\n";
}
If you've stat()ed the file, you can use the mode information to determine
this, but it's probably just as fast and certainly ten times clearer to
use these file test operators. They're documented in the giant perlfunc(1)
man page, under -X.
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/