[Wellington-pm] I must be stupid...
Andrew McMillan
andrew at morphoss.com
Tue May 5 17:51:09 PDT 2009
On Tue, 2009-05-05 at 19:03 +0800, Gaurav Vaidya wrote:
> 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.
Thanks. It seems I was being (very) thick. I blame it on too many late
nights. I had something like this in plenty of other places in my
program too.
> Also: hello from Singapore!
Heh. How appropriate to get my answer from .sg indeed :-)
Cheers,
Andrew.
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Just to have it is enough.
------------------------------------------------------------------------
More information about the Wellington-pm
mailing list