Perl command.

Undef as a verb (that is, used with parameters) means "discard the value of this variable". For example, undef $foo; removes the value of variable $foo.

Undef as a noun (that is, used as a parameter) means "value is undefined". For example, if($something < $everything) { return $something; } else { return undef; } will return $something if the condition is true, otherwise it returns an undefined value.

Note that undefined value is different from simply false value, a variable that doesn't exist, and a hash key that doesn't exist. For example, if you say $hash{'key'} = undef; then exists $hash{'key'} will be true, but defined $hash{'key'} is false. Likewise, if you say $foo = 0; then $foo is defined, but it's a false value.

Log in or register to write something here or to contact authors.