develooper Front page | perl.perl5.porters | Postings from September 2003

Re: optimizing /\s*,\s*/

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
September 8, 2003 11:07
Subject:
Re: optimizing /\s*,\s*/
Message ID:
Pine.LNX.4.44.0309081405530.27901-100000@redcap.sidhe.org
On Mon, 8 Sep 2003, H.Merijn Brand wrote:

> On Mon 08 Sep 2003 19:36, "Jeff 'japhy' Pinyan" <japhy@perlmonk.org> wrote:
> > A lot of times, when people want to split a string into comma-separated
> > fields, they use something like
> > 
> >   @fields = split /\s*,\s*/, $string;
> 
> Yes, I do a lot of split m/\s*\|\s*/, $_, -1
> What's naive? It's probably an 'Ahh, sure. Darn I forgot.' but enlighten me.

Probably the issue of commas (or other delimiters) inside quoted strings. 
That's the one that bites most people.

					Dan


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About