- or download this
#!/usr/bin/env perl
use strict;
...
original: This is a string with variable numbers of
+ spaces.
cleaned: This is a string with variable numbers of spaces.
# of substitutions: 6
- or download this
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).
- or download this
my $cleaned = $token->as_is =~ s/\s{2,}/ /gr;