Refactor 

sub format {
  my($self, $text) = @_;

  my @words = $text =~ m/(\S+)/g;
  return join ' ', @words;
}