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


in reply to Re: In search of a better way to trim string length
in thread In search of a better way to trim string

Thanks, BrowserUk!

Very cool code but harder to understand for me...I ran it and got the results as expected, with a tiny 'bug'. When I passed it the string "this is a very long sentence without spaces in between", the shortened string was "this is a very long ..." (no problem there).

When I passed it the string "thisisaverylongsentencewithoutspacesinbetween", the output was "thisisaverylongsentencewith..." i.e. without any space between the last character of that string and '...'.

Nothing serious really but just thought I would bring it up.