1 |
defined(expr); # where expr is typically a variable such as $list[7]
|
2 |
returns true if expr is defined (i.e. not equal to undef)
|
3 |
undef $scalar; undef @list; undef %hash; # set all elements in passed reference to be undefined -- the argument can also be things like $hash{key};
-
undef on its own represents undefined value for returning from subroutines etc.
|
4 |
undef can be very useful -- for instance you may wish to reuse a hash %parms and execuate undef %parms before re-use.
|
5 |
exists($hash{place}); returns true if place has been defined as a key to %hash-- note this tests existence of associative memory key -- the value $hash{place} may still be undefined!
|