Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Perl has a set of file test operators that let you get
particular information about files. They all take the form of -X, where the X represents the particular test (and there is
a literal -X file test operator too,
to confuse things a bit). In most cases, these operators return true or
false. Although we call these things operators, you’ll find their
documentation in perlfunc.[303]
Before you start a program that creates a new file, you might want
to ensure that the file doesn’t already exist so that you don’t
accidentally overwrite a vital spreadsheet data file or that important
birthday calendar. For this, you can use the -e file test, testing a filename for
existence: