use Sub::Identify qw(sub_name); sub foo {} print sub_name(\&foo);