use PerlIO::Scalar; # to avoid recursion when creating $fh sub require_local { # do the actual work, per the source I posted earlier # ... open my $fh, '<', \'1'; return $fh; }