Perl exists Function



Description

This function returns true if the specified hash or array key exists, regardless of the corresponding value, even if it.s undef. If EXPR is a subroutine, then exists will return 1 if the subroutine has been declared (but not necessarily defined), 0 if not.

If LIST is more than one argument, or an array with more than one value, then the command is executed directly without the use of a shell.

Syntax

Following is the simple syntax for this function −

exists EXPR

Return Value

This function returns 0 if hash element or array index does not exist, or if the subroutine has not been declared and 1 if hash element or array index does exist, or if the subroutine has not been declared.

perl_function_references.htm
Advertisements