http://www.perlmonks.org?node_id=817633


in reply to Why is "for" much slower than "while"?

for reads in the entire file, building a list of lines and then iterates over that list. while reads the file one line at a time.

Update: Links fixed. Thanks toolic.