$line =~ s/\s+/ /g; # replace more than one space with one space
This replaces a sequence of whitespaces with a single space char. This might or might not be what the poster wanted. To just affect spaces and replaces multiple occurrences with one, I'd recommend tr///: $line =~ tr/ / /s;
-- Hofmator
In reply to Re: Re: simple regex problem
by Hofmator
in thread simple regex problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |