web07:~[0]% perl $_ = 'word 0 word'; my @a = grep {s/(?<=\d),(?=\d)//g || $_} split; print join ':', @a, "\n"; ^D word:word: web07:~[0]%