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

Gosh has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!
I want to delete all the 'spaces' between non "word" characters:
my $line = "& & &"; $line =~ s/(\W)\s+(\W)/$1$2/g; print $line;
The program outputs "&& &" but I expect "&&&"
Could You explain me why output is "&& &" but not "&&&"? Could You help me how to reach my goal? Thanks!