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

fauxpas has asked for the wisdom of the Perl Monks concerning the following question:

What's a quick way to read in a line (as defined by $/) with a specified maximum length? I want to read in lines of input from unauthenticated connections over the network and I'm worried that by using <FILEHANDLE> I allow someone to blow out the memory on my server. Something that's as easy to use as

while ( $line=read_a_line(FILEHANDLE,$maxlinelen) ) {}

would be nice. =)