> Hello, can you guys show me how to convert each non-alphanumeric
> character in a string to a space, and then convert any number of
> consecutive spaces in the string to a single space?
>
> If I need to specify exactly which characters I want converted to
> spaces, I'd be happy with just the "." character.

Hi Grant.

$text =~ s/[^[:alnum:]]/ /g;
$text =~ s/\s+/ /g;

will do what you want.

Works like a charm.  Thanks Rob!

- Grant

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to