Perl’s pre-unary does-this-file-exist operator. It takes either a filename or a filehandle as its argument, although checking if an open file exists is a bit silly. If the argument is omitted, it will use $_ instead. Returns 1 if the file exists and the undefined value if it does not. -d and -s are probably the most useful file test operators to combine with –e.

-e is also a command-line switch for perl.exe, completely unrelated to the above use. Turning it on causes Perl to execute whatever comes next as if it were a script instead of using it as a filename. Quotes are required if your script has any spaces in it.

Reference: Programming Perl and fiddling with ActivePerl

Log in or register to write something here or to contact authors.