optimizing successive text lines does not work on older versions of Perl