A random entry from off by one

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>;

...is 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.


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