Think about Loose Coupling | |
PerlMonks |
Re: Re: simple regex problemby Hofmator (Curate) |
on Mar 07, 2003 at 12:16 UTC ( [id://241118]=note: print w/replies, xml ) | Need Help?? |
$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 Section
Seekers of Perl Wisdom
|
|