unshift(@ARGV, "-") if @ARGV == 0; FILE: for my $quasi_filename (@ARGV) { # don't let magic open make an output handle my $file = $quasi_filename; $file = "standard input" if $file eq q(-); debug("opening $file"); $quasi_filename =~ s/^(?=[\h\v]*[>|])/< /; # Down the rabbit hole: I'm using filehandle names that match # the handles themselves to aid in debugging message. Silly # perl thinks this is somehow symbolic dereferencing. no strict "refs"; my $fh = $file; # is *so* a lexical filehandle!!! unless (open($fh, $quasi_filename)) { yuck("couldn't open $quasi_filename: $!"); next FILE; } set_encoding($fh, $file) || next FILE; LINE: for(;;) { my $line = eval { use warnings "FATAL" => "all"; scalar <$fh>; }; if ($@) { $@ =~ s/ at \K.*? line \d+.*/$file line $./; yuck("read failure: $@"); if ($. == 0) { last LINE } else { next LINE } } last LINE unless defined $line; last LINE unless length $line; ...