Luiz de Andrade Luiz de Andrade - 7 months ago 10
Perl Question

What does "-e" do inside an expression in Perl?

I ran into this piece of code:

unless(-e $SNMPWALK)
{
print "snmpwalk is not installed!\n";
exit 3;
}


What is the function of
-e
in this expression?

Answer

It's one of the file test operators. In this case it tests whether the file whose name is in $SNMPWALK exists

It's documented in perlfunc under perldoc -X