use constant READSIZE => ...; my $fh = ...; my $start = ...; my $end = ...; ## check $end < -s($fh)! seek $fh, $start, 0; while( ($_ = tell( $fh ) ) < $end ) { local $/ = \min( READSIZE, $end - $_ ); my $chunk = <$fh> or die $!; ## ... }