use Text::Truncate; my $short = truncstr($long, $len);