in reply to Insert comma after every character
So, you have "F", "B", a space, "D" and want to turn that into "F", comma, space, "B", comma, space, "D"? The simplest way is:
Are we free to generalize this? Here's a broad generalization:$str = "F, B, D" if $str eq "FB D";
Or do you want something else? Perhaps you can describe it, instead of assume we're all omniscient, and can deduce what you want from a single example, and some botched code.$str = "F, B, D";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Insert comma after every character
by johngg (Canon) on Apr 21, 2010 at 16:12 UTC |
In Section
Seekers of Perl Wisdom