sub foo { } foreach (qw[ foo bar ]) { print "$_? ",(defined(*$_{CODE})? "defined":"undef"), "\n"; }