sub hello { }; # declared and defined *fn = $::{'hello'}; print "declared\n" if *fn{CODE}; print "defined\n" if defined &fn;