my $smstext = "This sentence will have more than 120 characters and i want to truncate this string into two lines containing 60 characters each and ignore characters above 140 in length" ; use Text::Wrap; local $Text::Wrap::columns = 60; my($text) = wrap('', '', substr($smstext, 0, 140)) =~ /^(.*\n.*\n)/; print $text; __END__ Output: This sentence will have more than 120 characters and i want to truncate this string into two lines containing 60