use warnings; use Math::BigInt; use strict; use Inline C => Config => BUILD_NOISY => 1, USING => 'ParseRegExp'; use Inline C => <<'END'; int is_ref(SV * x) { if(SvROK(x)) return 1; return 0; } int is_obj(SV * x) { if(sv_isobject(x)) return 1; return 0; } END my $undef; my $ref = \$undef; my $obj = Math::BigInt->new(0); for($undef, $ref, $obj) { print is_ref($_), " ", is_obj($_), "\n"; } # Output: # 0 0 # 1 0 # 1 1