John Delacour wrote: > At 5:46 pm +0200 6/10/02, Adriano Allora wrote: > >> When I use it in a regexp (s/\s+/\s/g;)(I want it works to singularize >> all the multi-whitespaces), the Terminal tells me: >> Unrecognized escape \s passed through at cleaner line 27. > > > \s means ANY white space character, so in your substitution pattern it > is meaningless; instead you must use a space > > > > #!/usr/bin/perl -w > $_ = "lots of white space" ; > s~\s+~ ~g ; > print ; > > JD >
s/ +/ /g; seems to work just as well. Which begs the question... why even have \s? maybe because tmtowtdi?! puneet.
