SPUG: Handling big files

Tim Maher tim at consultix-inc.com
Thu Jan 22 12:44:30 CST 2004

    > I have a question I need to open a files between 5 and 35 megs
    > and work with those files but my question is how can I open the
    > files using the min amount of memory??..
    > Thanks,
    > Luis

    If the processing you need to do allows it, just read the lines
    one at a time, in a loop -- then you'll only have one line's worth
    of memory in use at any time.

    If you need to actually have access to the files as if they were
    in memory (without paying the price for really storing them there),
    you could use the Tie::File module: 


    Have fun!

    | Tim Maher, CEO     (206) 781-UNIX      (866) DOC-PERL     (866) DOC-UNIX |
    | tim(AT)Consultix-Inc.Com  http://TeachMePerl.Com  http://TeachMeUnix.Com |
    |  Watch for my Manning book: "Minimal Perl for Shell Users & Programmers" |

More information about the spug-list mailing list