or you could use $str =~ s/\b \b//g;
...only if all the *non-space* characters are *word* characters:
my $str = '@@@@ $$$ *** )))'; $str =~ s/\b \b//g; print $str;
In reply to Re^3: Regular Expressions: Removing 'only' single spaces from a string
by Not_a_Number
in thread Regular Expressions: Removing 'only' single spaces from a string
by BioBoy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |