"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 filenamedetermines if filenameexists. -rdetermines if the file is readable, -wif it's writeable, -xif it is executable and so on.

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

Written by Shlomi Fish