in reply to Questions about curious idiom seen in package

undef($variable) sets a variable to undef.

undef(my $variable) declares a variable and sets it to undef in the same statement. However, scalar variables default to undef anyway so there's no point in it.

Replies are listed 'Best First'.
Re^2: Questions about curious idiom seen in package
by ikegami (Patriarch) on Feb 18, 2019 at 01:08 UTC

    More precisely, $var = undef; sets a var to undef. undef $var; also frees any buffers associated with the variable. This will usually result in a performance penalty.