http://qs1969.pair.com?node_id=836065


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