I use this series of regexp all over the place to clean up lines of text: $x=~s/^\s+//g; $x=~s/\s+$//g; $x=~s/\s+/ /g;
in that order, and note the final one replace \s+ with a single space. Basically, it's (1) remove all leading space, (2) remove all trailing space, and (3) replace all multi-space with a single space [which, at this point, should only occur on interior characters]. Is there a handy way to do this in one regexp? And, fast? I've been using Devel::NYTProf to study code timing and see that some regexp, especially mine, can be CPU expensive/intensive. Thanks! David -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/