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 PST ah, time for my yearly smattering of blog posts:

Annnnnnnnnnd we're back.

Today's hot tip:

@filearray = <FILE>;

...is a bad idea if <FILE> is rilly large!

Thank you good night.

(No Perl jokes, please.)

Update:

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


[Main]

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