Text::Trim does what chomp does, but at both ends of the string.

WWW: http://search.cpan.org/dist/Text-Trim/
