Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

defined

Tests whether a value is defined (not undef).

Pops one value from the stack and pushes 1 if it is defined, 0 otherwise. For code values (Cv), “defined” means the CV has actual executable code and is not merely an empty stub. For all other types, delegates to Sv::is_defined().

Synopsis

if (defined $x)        { ... }
if (defined &func)     { ... }   # is sub defined (not a stub)?
if (defined $hash{$k}) { ... }

See Also

undef, exists