in reply to Reading in N lines at a time
... until (eof(FH)) { for my $i (1..6) { my $line = <FH>; last unless defined $line; chomp $line; redo if ($line =~ /^\s*(?:#|$)/); if ($line=~m#(map|reverse_map)\s+(\w+)://(\S*?)\s+(\2)://(\S*? +)$#) { $vars{'d'} = $.; $vars{'map'} = $1; $vars{'proto'} = $2; $vars{'uri1'} = $3; $vars{'uri2'} = $4; } } #do some thing with $vars before here. #6 lines (or as many as remained in the file) will have been read +at this point }
|
|---|