in reply to Propose addition to use warnings?

I don't understand your question. Do you mean Perl should warn when you pass a closed filehandle to a subroutine?

There's nothing inherently wrong in passing a filehandle:

#!/usr/bin/perl use warnings; use strict; main(@ARGV); sub main { my ($file1, $file2) = @_; open my $fh, '<', $file1 or die $!; print "first: $_" while <$fh>; close $fh; again($fh, $file2); print "again: $_" while <$fh>; } sub again { my ($fh, $name) = @_; open $fh, '<', $name or die $!; }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Propose addition to use warnings?
by perldigious (Priest) on Nov 28, 2016 at 18:29 UTC

    Do you mean Perl should warn when you pass a closed filehandle to a subroutine?

    Yes, that's what I was asking about, but reading davido's reply makes me think that may not be a reasonable expectation. Perl just usually spoils me by telling me when I'm trying to do something that's probably stupid, and this is a case where I was and it didn't. :-)

    Just another Perl hooker - will code for food

      Well to perl's credit, it *did*, but just later on, and inside of an edge-case conditional statement ;)