Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Insert comma after every character

by chuckbutler (Parson)
on Apr 21, 2010 at 15:08 UTC ( #836090=note: print w/ replies, xml ) Need Help??

in reply to Insert comma after every character

If the result is to have a comma after each character, save the last one:

$perl -we "($_='FBD') =~ s/(.)(?!$)/$1,/g; print;" ~~Output~~ F,B,D

the assertion of any character with a zero assertion of not at the end of line should do fine.

Good luck. -c

Update: fixed typo...

Comment on Re: Insert comma after every character
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2015-11-30 09:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (769 votes), past polls