Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Insert comma after every character

by chuckbutler (Monsignor)
on Apr 21, 2010 at 15:08 UTC ( [id://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...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-16 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found