in reply to how can a subroutine find out the name of it's caller?

To clarifie, the caller gets the contect of the CURRENT subroutine call, hence
#!/usr/bin/perl -w use strict; sub jojo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(1); print "2: " . $subroutine . "\n"; } sub jo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(1); print "1: " . $subroutine . "\n"; jojo; } jo;
would print:
Use of uninitialized value in concatenation (.) or string at ./test.pl line 11.
1:
2: main::jo
As you see, the first call doesn't show a caller, since there is no sub that clalled it, only the package would be known, and you should give the depth of info, thus the following should work
#!/usr/bin/perl -w use strict; sub jojo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(1); print "2: $package - $subroutine \n"; } sub jo { my ($package, $filename, $line, $subroutine, $hasargs, $wantar +ray, $evaltext, $is_require) = caller(); print "1: $package - $subroutine \n"; jojo; } jo;

That prints:
1: main -
2: main - main::jo