How can I set a code that must execute before a Perl script stops?
In here how to run piece of code just before the exit of perl script I read about the END subroutine, but it only executes if the script ends normally. However, I want the code to be executed also if, for example, user aborts the program by ^C.
Trap the termination signals and re-route them so something, simplest would be: