http://www.perlmonks.org?node_id=713838


in reply to caller() mystery

There's only two levels of caller in this case. Do you expect it to return the name of your shell?
use strict; use warnings; sub _format_caller { my @x=caller($_[0]); print(join(',',@x[0..2]),"\n"); } sub f { my $level=$_[0]; print "test caller $level\n"; _format_caller($level); print("\n"); } f($_) for 0..2;
test caller 0 main,713838.pl,12 test caller 1 main,713838.pl,16 test caller 2 Use of uninitialized value in join or string at 713838.pl line 6. Use of uninitialized value in join or string at 713838.pl line 6. Use of uninitialized value in join or string at 713838.pl line 6. ,,