use strict; use warnings; if (exists &FOO::bar) { print "bar exists in foo\n"; } package FOO; sub bar { }