in reply to anonymous filehandle for overridden open sub

  1. If security matters to you, convert to:
    open( my $fh, "<", $file ); if ( $fh ) { ... } else { log_error( "Couldn't open $file for 'reading': $!" ); }
    If you don't log why you couldn't open the filehandle, there's no point. Plus, open() implicitly performs a -e check, so that's superfluous. Now, doing a -d check might be more useful ...
  2. No, I haven't found a way to do what you're asking. I tried for an article I wrote for http://www.perl.com, but you cannot treat a bare string filename as a variable under strict, which is a pity.