Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Replace the nth occurence

by grizzley (Chaplain)
on Nov 21, 2012 at 12:21 UTC ( #1004906=note: print w/ replies, xml ) Need Help??


in reply to Replace the nth occurence

my $count = 1; my $str = "a,b,c,d"; $str =~ s/((,.*?){$count}),/$1|/; print $str;


Comment on Re: Replace the nth occurence
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-10-02 07:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (50 votes), past polls