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:
Could You explain me why output is "&& &" but not "&&&"? Could You help me how to reach my goal? Thanks!
I want to delete all the 'spaces' between non "word" characters:
The program outputs "&& &" but I expect "&&&"my $line = "& & &"; $line =~ s/(\W)\s+(\W)/$1$2/g; print $line;
Could You explain me why output is "&& &" but not "&&&"? Could You help me how to reach my goal? Thanks!
Back to
Seekers of Perl Wisdom