Perl exists Function
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.
Following is the simple syntax for this function −
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.
Following is the example code showing its basic usage −
When above code is executed, it produces the following result −