in reply to find out method name from the reference

If you can provide the package name as a parameter then you can:

use strict; use warnings; package Foo; sub Bar { } package main; sub test { my ($package, $function_ref) = @_; no strict; for my $key (keys %{"${package}::"}) { my $ref = ${"${package}::"}{$key}; if (defined $ref && \&$ref eq $function_ref) { print "${package}::$key\n"; } } } test ('Foo', \&Foo::Bar);

Prints:

Foo::Bar

Perl reduces RSI - it saves typing