"Perl for Perl Newbies" - Part 4More System FunctionsFile Tests (-e, -d...)

7.3. File Tests (-e, -d...)

Perl provides several file tests that can be used to test a filehandle or filename for various conditions. -e filename determines if filename exists. -r determines if the file is readable, -w if it's writeable, -x if it is executable and so on.

-d determines if the file is a directory, and -f if it's a plain file. For a list of other file tests and their use consult perldoc -f -X.

Written by Shlomi Fish