in reply to How do I test the validity of a CODE reference?

print "valid\n" if defined &$sub;

Dave.