in reply to Templatize Repeated code

You may find caller is of help. Consider:

use strict; use warnings; Logit (); sub Logit { Log ("In Logit"); } sub Log { my $str =shift; my ($package, $filename, $line, $subroutine) = caller 1; print "$subroutine $filename ($line): $str\n" }

Prints:

main::Logit noname.pl (4): In Logit

DWIM is Perl's answer to Gödel