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


in reply to Perl Regex with Extra Spaces

What you want is y/ //s