my $cleaned = $token->as_is; $cleaned =~ s/\s{2,}/ /g; # I took out the /s modifier. I thought it was only for transliteration (e.g., $cleaned =~ tr/ //s).