...or more legibly
use strict; use warnings; use IO::Handle; my $current_line_num; while (my $line = <DATA>) { $current_line_num = DATA->input_line_number(); if( $current_line_num >= 2 and $current_line_num <= 7) { print $line; } }
And if the file is only 100 or so lines long, how about an array slice?
for ( (<DATA>)[1..6] ) { print; }
In reply to Re^2: regex issue
by 7stud
in thread regex issue
by pinnacle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |