scope_guard#
scope_guard BLOCK: run BLOCK when the enclosing scope is left - at its end, by return, last/next, or an exception passing through. Several in one scope run in reverse order of creation. Exported by default.
{
my $lock = acquire();
scope_guard { release($lock) };
work(); # release runs even if this dies
}