sub main_loop { local($dbh->{AutoCommit}) = 0; ... lots of code here, with multiple returns } #### my $tmp_dbh = $dbh; $tmp_dbh->{AutoCommit} = 0; #BZZT! #### # Wishful thinking sub main_loop { ... stuff happens ... } continue { ... oops! I must have returned! } #### sub main_loop { { ... stuff happens ... ... use 'last' instead of 'return'? } ... restore settings here }