http://qs1969.pair.com?node_id=623581


in reply to Safely reading line by line

I'd just impose a memory limit to the perl interpreter process, and die automatically if a line is too long.

Of course that's only possible if you don't mind losing some data from possibly manipulated sources, and don't leave damaged data structures behind (on disk, that is).