use strict; sub trace_wrapper_no_frame { my $f=shift; return sub { print "Trace, no frame\n"; goto $f; }; } sub trace_wrapper_frame { my $f=shift; return sub { print "Trace, with frame\n"; $f->(@_); # <----- LINE 15 }; } sub who_says_hello { print(join(" ",caller), "\n"); print "Hello, $_[0]\n"; } who_says_hello("World"); # <------ LINE 26 print '-' x 20, "\n"; my $frame_wrapped_hello = trace_wrapper_frame(\&who_says_hello); $frame_wrapped_hello->("dolly"); print '-' x 20, "\n"; my $no_frame_wrapped_hello = trace_wrapper_no_frame(\&who_says_hello); $no_frame_wrapped_hello->("Fifty"); #<----- LINE 36 #### From line # 26 Hello, World -------------------- Trace, with frame From line # 15 Hello, dolly -------------------- Trace, no frame From line # 36 Hello, Fifty