If you have only one range and one, possibly concatenated input stream, you can use:
if (my $seqno = 1 .. 3) {
print;
exit if $seqno =~ /E/;
}
But if you want it to apply to every input file, you need to catch the end of each file:
print if my $seqno = 1 .. 3;
close ARGV if eof || $seqno =~ /E/;
And if you want to be kind to people who forget args, add a good warning to the sentence BEGINor INIT:
BEGIN { warn "$0: reading from stdin\n" if @ARGV == 0 && -t }
print if my $seqno = 1 .. 3;
close ARGV if eof || $seqno =~ /E/;
:
-n -p #!. ( ) , ‑l ‑a.
readline, 1 ..
3 ($. == 1) .. ($. ==
3).
eof parens , ARGV . eof(), <ARGV>.
- "E0".
-t, libcs isatty(3), STDIN - filetest.
A BEGIN{} , , script ‑MO=Deparse, , , . INIT{} .
, , LINE, , , , .