#!perl use warnings; use strict; use Log::Log4perl; Log::Log4perl->init_and_watch('yourlogger.conf', 10); my $logger = Log::Log4perl::get_logger('test_die'); $logger->warn("before eval"); eval { die 'foo'; }; if($@) { print $@; # I expect this to print "foo", it does $logger->debug('test'); print $@; # I expect this to print "foo", it doesn't! print 'after printing $@'; } print "\n";