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 johngg (Canon)
on Apr 21, 2010 at 14:01 UTC ( #836065=note: print w/replies, xml ) Need Help??


in reply to Insert comma after every character

Yet another way would be to use substr working back from the right end of the string.

knoppix@Microknoppix:~$ perl -E ' > $str = q{ABCDEFG}; > substr $str, $_, 0, q{,} for reverse 1 .. length( $str ) - 1; > say $str;' A,B,C,D,E,F,G knoppix@Microknoppix:~$

I hope this is useful.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2022-12-10 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?