use strict; use warnings; use Carp; use constant ERR_BACKTRACE => 1; BEGIN { if (ERR_BACKTRACE) { *CORE::GLOBAL::warn = \&Carp::cluck; *CORE::GLOBAL::die = \&Carp::confess; } } sub t2{ warn "warn with trace"; } sub t1 { t2(21,22,23); die "die with trace"; } t1(11,12,13); #### Compilation started at Fri Sep 27 15:18:09 C:/Perl_524/bin\perl.exe d:/exp/t_carp.pl warn with trace at d:/exp/t_carp.pl line 17. main::t2(21, 22, 23) called at d:/exp/t_carp.pl line 21 main::t1(11, 12, 13) called at d:/exp/t_carp.pl line 25 die with trace at d:/exp/t_carp.pl line 22. main::t1(11, 12, 13) called at d:/exp/t_carp.pl line 25 Compilation exited abnormally with code 255 at Fri Sep 27 15:18:10