use strict; use Carp qw(cluck); sub test_errors { cluck "First test message"; my $long = Carp::longmess("Second test message"); my $short = Carp::longmess("Third test message"); print STDERR $long; print STDERR $short; test2(); } sub test2 { cluck "Fourth test message"; my $long = Carp::longmess("Fifth test message"); my $short = Carp::longmess("Sixth test message"); print STDERR $long; print STDERR $short; } test_errors(); #### First test message at cluckt line 8 main::test_errors() called at cluckt line 30 Second test message at cluckt line 30 Third test message at cluckt line 30 Fourth test message at cluckt line 21 main::test2() called at cluckt line 16 main::test_errors() called at cluckt line 30 Fifth test message at cluckt line 16 main::test_errors() called at cluckt line 30 Sixth test message at cluckt line 16 main::test_errors() called at cluckt line 30