SPUG: perl newbie with annoying little issue ...
Terry Nightingale
tnight at pobox.com
Tue Nov 28 17:16:19 CST 2000
On Tue, 28 Nov 2000, Joshua Lanza wrote:
> hi all -- sorry for the trivial nature of this one:
>
> can anyone tell me how to determine if a file is a directory or a leaf? (i'm
> looking for something similar to java's "isDirectory()" method in the File
> class)
That's what Perl's file test operators are for. For example:
if (-d $file) {
print "$file is a directory!\n";
}
elsif (-f $file) {
print "$file is a leaf!\n";
}
else {
print "$file is something else!\n";
}
--
Terry Nightingale <tnight at pobox.com>
+1-425-649-9304(v) / +1-425-643-7112(f)
Prediction is very difficult, especially of the future. -Niels Bohr
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list