--- name: undef status: documented runtime: pp source: src/runtime/pp/array_ops.rs --- ```{index} single: undef; Perl built-in (pp runtime) ``` # undef ## Synopsis ```perl my $x = undef; undef $x; # set $x to undef undef @array; # clear the array undef %hash; # clear the hash my (undef, @rest) = @list; # skip first element in list assignment ``` ## Description Produces the undefined value, or undefines an existing variable. Operates in three modes determined by op flags: - **MOD (lvalue placeholder):** Used in list assignment patterns like `my (undef, $x) = @list`. Adds a sentinel to `lvalue_targets` so `pp_aassign` skips that position. - **STACKED (function call `undef $x`):** Pops the target from the stack and undefines it. For arrays and hashes this clears the container; for hash/array element targets it sets the element to `undef`; for scalars it writes `undef` through the alias. - **Default:** If `targ` is set, sets the corresponding pad slot to `undef`. Always pushes `undef` onto the stack as the return value. ## See also defined