"undef isn't"

1. but undef can be
2. undef isn't undef
3. if undef were

but undef can be something:

* undef $foo
* PL_sv_undef
* !SvOK

undef isn't undef

* perldoc -f undef
* perldoc perlguts
* books, tutorials, source!

if undef were

* Can't change docs
* Next best thing: make the docs lie
* Change undef!

Problem

* undef has the readonly flag set
* Unset it!
* Internals::SvREADONLY($scalar, 0)

undef as a variable

* Internals::SvREADONLY(${\undef}, 0)
* undef = 5
* woohoo!

More fun

Internals::SvREADONLY(${\undef}, 0);

undef = 42;
print undef;  # 42!
print defined(undef) ? "true" : "false";  # true!
for (undef = 1; undef() < 6; ++undef) {
    print open(my $fh, "nonexistent"), "\n";
}

Let's tie undef!

my $not_SvOK = undef;
sub FETCH { rand() < .5 ? 42 : $not_SvOK }

tie ${\undef}, 'main';

If you feel lucky

* true (PL_sv_yes) ${\!0}
* false (PL_sv_no) ${\!1}