sub read_n_lines { my ($fh, $count) = @_; my $buffer; $buffer .= $_ for 1 .. $count; return $buffer; } #### open(my $handle, 'c:/file.log') or die "Can't read file: $!\n"; while(not eof( $handle )) { my $chunk = read_n_lines( $handle, 100 ); my $parsed = parse_chunk( $chunk ); print_parsed( $parsed ); }