|
|
| P is for Practical | |
| PerlMonks |
Re^3: How to remove other language character from a stringby frozenwithjoy (Deacon) |
| on Nov 26, 2012 at 05:51 UTC ( #1005565=note: print w/ replies, xml ) | Need Help?? |
|
That's because it wasn't formatted correctly due to missing code tags (which were presumably left out so that the input text would be shown properly). When I first ran moritz's code, I just got the original string, but when I substituted: $str =~ s/[^\p{Latin}\s]//g;for this: $str =~ s/^\p{Latin}\s//g;it worked. EDIT: If you have lots of extra spaces in your output, you could run it through $str =~ s/ {2,}/ /g;, too. Something to keep in mind is that moritz's approach (as is) will remove punctuation.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||