undef in Perl

undef

undef is the "unknown value" of Perl. undef is the initial value of scalar variables.

See undef explained in a video and how to return nothing (or undef) from a function in Perl?

It is also a function that can be used to set variables to be undefined. See undef on Perl arrays and hashes.

You can tell apart variables that are undef and that are not by using the defined function.

Other pages

undef - defined - true -false
true
min, max, sum in Perl using List::Util
false
false
exists - check if a key exists in a hash
defined
defined
defined
The curious case of implicit return
Reading and writing binary files in Perl
Passing multiple parameters to a function in Perl
Exchange values and keys of a hash - how to reverse a hash

Author

Gabor Szabo (szabgab) Gabor Szabo