use B; use constant CONST => 0x0200; sub is_constant { no strict 'refs'; my $name = shift; my $code = *{$name}{CODE}; my $obj = B::svref_2object($code); return 1 if $obj->isa('B::CV') and $obj->CvFLAGS & CONST; return 0; }