Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Regex to replace consecutive tokens

by choroba (Cardinal)
on Oct 18, 2013 at 13:44 UTC ( [id://1058758]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $t = '1,2,3,,5,6,,,9,10,,,,14,15,,,,,,,,,,,,,,,';
    my $s = join ',' => map { $_ ne '' ? $_ : '0' }
                        split /,/ => $t, 1 + $t =~ y/,//;
    
  2. or download this
    my $s = join ',' => map $_ || 0,
                        split /,/ => $t, 1 + $t =~ y/,//;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2024-04-23 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found