Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Double-duty commas

by Enlil (Parson)
on Feb 25, 2005 at 17:34 UTC ( #434587=note: print w/replies, xml ) Need Help??


in reply to Double-duty commas

If trailing commas (on each line) would not an issue this might work for what you are doing:
#!/usr/bin/perl -w use strict; use warnings; $_ = 'foo:a,bar:a,b,c,baz:d,faa:this,is,great'; my @array = m/(\w+:(?:(?>\w+,?)+)(?!:))/g; print $_,$/ for @array; __END__ foo:a, bar:a,b,c, baz:d, faa:this,is,great

update: Re: Double-duty commas is much more elegant

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://434587]
help
Chatterbox?
[GotToBTru]: okay, fess up, who installed CB::Typo?
[Discipulus]: at 7th floor seagulls eat mice
[Discipulus]: just in Eataly: brain surgery while playing clarinet..
[erix]: installing perfect pitch?

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2017-11-17 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?