if (length($string) > 15) { unless ($string =~ s/^(.{0,12})\b\s.*/$1.../gi) { $string = substr ($string, 0, 12) . '...'; } }