John Rambo John Rambo - 7 months ago 18
Perl Question

What does -e mean in an if statement?

I found the following in some Perl code:

if (! -e $options{"inPath"}){
$logger->fatal("Directory \'$options{\"inPath\"}\' does not exist.\n");
}


What does the
-e
in the
if
statement do?

Answer

See Perl file tests in the online perl documentation site. -e '/foo' returns true if the file /foo exists.

You can access it also from the command line if you have perldoc installed in your system.

perldoc -f -X