off by one for 2010 October 29 (entry 0)

< disabling the caches in Linux
mairix rocks >

[Trackback URL for this entry] Fri Oct 29 21:00:40 ah, time for my yearly smattering of blog posts:

Annnnnnnnnnd we're back.

Today's hot tip:

@filearray = <FILE>; a bad idea if <FILE> is rilly large!

Thank you good night.

(No Perl jokes, please.)


Also, don't do:

foreach (<FILE>)

... it's basically just as bad.

Instead, you are WAY better off doing:

while ($line = <FILE>)

... which only reads one line at a time. You get the same functionality at a fraction of the memory usage.

Filed under: technical:coding


Unless otherwise noted, all content licensed by Peter A. H. Peterson
under a Creative Commons License.