Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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

Comment on Re: Double-duty commas
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://434587]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2015-07-28 18:26 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (258 votes), past polls