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


in reply to How do you limit textarea of a form

A possible perl solution is removing some of the newlines, like:

s/\n{3,}/\n\n/g;

which will replace three or more newlines in a row with two (two to preserve double-spacing of paragraphs).