http://www.perlmonks.org?node_id=984549


in reply to Removing extra spaces

s/\s(\s?)/$1/g

Match a single space, and optionally a second space. Capture that second space if it exists. Replace with the capture, which will be either nothing, or the second space.


Dave