use 5.010; use Scope::CHECK; { BEGIN { Scope::CHECK::->add(sub { say 'Checking scope' }) } BEGIN { say 'End of scope' } } BEGIN { say 'After scope' } __END__ End of scope Checking scope After scope