$\ = $/; sub foo; print "foo ref is: ",\&foo; my $ref = \&foo; for (keys %main::) { print "1: ",*{$_}{NAME} if *{$_}{CODE} and *{$_}{CODE} eq $ref; } *bar = *foo; sub foo { print "in foo" } for (keys %main::) { print "2: ",*{$_}{NAME} if *{$_}{CODE} and *{$_}{CODE} eq $ref; } bar(); __END__ foo ref is: CODE(0x91cf78c) 1: foo 2: bar 2: foo in foo