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


in reply to Help with $File:Find

push @array, $File::Find::name if (defined $_ && (/^.*\.($TYPES)$/i) +);

Replies are listed 'Best First'.
Re^2: Help with $File:Find
by tinita (Parson) on Feb 14, 2018 at 19:27 UTC
    It would be interesting to find out, though, when $_ an actually be undef. I can't find anything about that in the File::Find documentation. I only see a case where $File::Find::fullname is documented to be undef.
Re^2: Help with $File:Find
by roperl (Beadle) on Feb 14, 2018 at 18:58 UTC
    Ok I was thinking that but I wasn't sure if needed to check if $File::Find::name was defined.
    So I can write it as:
    push @array, $File::Find::name if ( ($_) && (/^.*\.($TYPES)$/i) );

    that is they syntax I've been using to check for defined without actually using "defined"