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


in reply to Re: substr question
in thread substr question

if ( length($short) + length($parts[0]) <= $len ) { $short = join( ' ', $short, shift @parts ); }

The length is off by one because you add not only the part, but a new space as well. The easy fix is to delete the = from <= $len