in reply to Finding the name of the target of a coderef
Until I tried it I didn't think it would work. I guess this works for the same reason the B trick works: that the system knows that a certain subroutine has a name, even when you call it through a reference.sub bar { print +(caller 0)[3]; } sub foo { bar } my $baz = \&foo; $baz->(); __END__ main::foo
|
|---|