in reply to Smoothing text input

Just grab the non-spaces?

sub wordBreak { my ($string) = @_; return $string =~ /\S+/g; }