perl:
sub do_stuff {
my $thing = Thing->new; # no need to manually destroy thing. Its DESTROY method will be called at the closing brace.
}