http://www.perlmonks.org?node_id=1209161

roperl has asked for the wisdom of the Perl Monks concerning the following question:

I'm using the File::Find module to find files that matches a certain type

Occasionally I get this in my STDERR log : "Use of uninitialized value $_ in pattern match (m//)" when using the code below
find( { wanted => \&get_files, preprocess => \&nodirs }, "$DIR" ) +; sub nodirs { grep !-d, @_; } sub get_files { my @array; push @array, $File::Find::name if ( (/^.*\.($TYPES)$/i) ); }
How can I check if $_ is initalized before matching the pattern?