my $dbh = shift ||' '; my $sth = shift ||' '; ... $sth->finish() if $sth; $dbh->disconnect() if $dbh;