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
.