my $txt = join ' ',@first_sentence; $txt =~ s/\s*([.()])\s*/$1/g; print $txt;