in reply to Re: Fast way to read from file
in thread Fast way to read from file

or combine substr and unpack with vec.
vec($offsets, $., 32) = tell IN while <IN>; ... seek $fh, vec($offsets, $line, 32), 0;

Replies are listed 'Best First'.
Re: Re: Re: Fast way to read from file
by BrowserUk (Patriarch) on Nov 21, 2003 at 16:23 UTC

    Good point. I should have thought of that, it's a nice simplification.

    It's a shame vec doesn't handle 24-bit integers, else we could cut the memory requirement by another 25% and still handle 16 millions line files which is probably sufficient for most purposes:)


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!