$SIG{__DIE__} = \&HandleDieError; while (){ handleDBProcess(); RemainingTask(); FinalTask(); } handleDBProcess { #do something #process } RemainingTask{ #again do something #but got error } FinalTask{ #Final task to process } HandleDieError { my $error = @_; if ($error){ #Fixed error #I want to continue } ##but doen't do anything #it shows running but no any process goes on }