Finally, Perl provides many methods for determining
information about files on the file system using "File tests".
For the purposes of this tutorial, there are too many
types of file tests to cover them all in depth. Further, they
are covered extensively elsewhere. However, the most
frequent syntax of file tests used in CGI applications
follows the form:
if ([filetest] [filename] && [other filetest] [filename])
{
do something
}
Consider the following example that checks to see if a
file exists (-e) and is writable (-w) by us, and if so deletes
it:
if ((-e "temp.file") && (-w "temp.file"))
{
unlink ("temp.file");
}
The following lists several common file
tests.