use 5.10.0; $| = 1; # make a scalar reference (blessed for DESTROY to be triggered) say bless \do { my $x }; # anonymous scalar gone? nope! say "done"; sub DESTROY { warn "destroying $_[0]\n"; } __END__ main=SCALAR(0x55f1ce2d6450) done destroying main=SCALAR(0x55f1ce2d6450)