in reply to how to shorten given string?

By the way, there is a package that does this:

use String::Escape; print String::Escape::elide( "Ipod batteries for Apple Ipod PDAs. Repl +acement batteries from Laptops for Less.com.url", 20 ); # Ipod batteries...