in reply to Run 2 Subroutines after a die

Doing things after we die is unattainable except for the most exaltred of our order. Doing the most essential things before we die should be our goal. It would seem to me that no more often that it would be called another sub might be wise:

#!perl.exe use strict; use warnings; my $var1 = "test.txt"; open TST, ">>$var1" or scram($var1, $!); print TST "Another Line\n"; close TST; sub One { print "In Sub ONE\n"; } sub Two { print "In Sub TWO\n"; } sub scram{ my ($filename, $exitmsg ) = @_; One(); Two(); die "Error opening $filename: $exitmsg\n"; }