my( $p, @index ) = 0; $index[ ++$p ] = tell( RAMFILE ) while ; ## Then to randomly access line $n of the file my $nthLine = substr( $bigstring, $index[ $n ], $index[ $n+1 ] - $index[ $n ] );