in reply to Regular Expressions: Removing 'only' single spaces from a string
Update: Ok the question was cleared up while I was writing this. Disreagard this post, the previous answers take care of it.
First, you want to be using s/// for regexes, not tr///.
$row_to_process =~ s/\s//g; # If you wanted to use tr/// (probably a bit faster here) $row_to_process =~ tr/ \n\t\r//d;
Will remove all whitespace from a string. After this, your question is a little confusing. You talk about removing only single spaces. Why would the space between "It" and "is" and the space "cold" and "now" not be removed.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|