#! perl -slw use 5.010; use strict; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'END_C', NAME => 'uCmp', CLEAN_AFTER_BUILD => 0; bool uCmp( SV* t ) { return (bool)( t == (&PL_sv_undef) ); } END_C print 'explicit undef: ', uCmp( undef ) ? 1 : 0; my $s; print 'uninitalised lexical: ', uCmp( $s ) ? 1 : 0; my @a; print 'uninitalised array element: ', uCmp( $a[ 5 ] ) ? 1 : 0; my %h; print 'uninitalised hash value: ', uCmp( $h{fred} ) ? 1 : 0; our $g; print 'uninitalised global: ', uCmp( $g ) ? 1 : 0; print 'Other unexplicit undef values: ', uCmp( `unknown_command` ) ? 1 : 0; __END__ C:\test>uCmp explicit undef: 1 uninitalised lexical: 0 uninitalised array element: 0 uninitalised hash value: 0 uninitalised global: 0 'unknown_command' is not recognized as an internal or external command, operable program or batch file. Usage: main::uCmp(t) at C:\test\uCmp.pl line 28.