[Wellington-pm] I must be stupid...
Gaurav Vaidya
gaurav at ggvaidya.com
Tue May 5 04:03:11 PDT 2009
Hi Andrew,
2009/5/5 Andrew McMillan <andrew at morphoss.com>:
> Can someone please explain to me why I get a difference between these:
> $text =~ s/\s+/ /s;
> vs.
> $text = join( ' ', split( /\s+/s, $text) );
I think it's the 'g': s/\s+/ /s will only replace the first continuous
sequence of whitespace with a single space. If you want to replace all
the spaces, you want s/\s+/ /sg.
Also: hello from Singapore!
cheers,
Gaurav
More information about the Wellington-pm
mailing list