Just another Perl shrine | |
PerlMonks |
split thisby pike (Monk) |
on Nov 06, 2001 at 17:34 UTC ( [id://123565]=perlquestion: print w/replies, xml ) | Need Help?? |
pike has asked for the wisdom of the Perl Monks concerning the following question:
Dear brethren,
here is my problem. I have a string, say 'E/stYna~ko/', and I want to split it into single letters, except '/' and '~' should be grouped with the preceding letter (they never appear at the beginning of the string) I.e. the desired output in the above case is 'E/ s t Y n a~ k o/'. Sounds like a job for split, right? Only that I can't get it to work properly. Here's what I have tried so far:
Yes, I know I could first split into individual characters and then go through the array and join the '/' and '~' with the preceding characters, but can't split give me the correct solution right away? Puzzled, pike
Back to
Seekers of Perl Wisdom
|
|