in reply to Reversing Arabic String direction

Well, it's hard to tell what to do without knowing any Arabic. Try this:
use utf8; use open qw(:encode(utf-8) :std); ... $arabic_string =~ s/(\p{L}+)/reverse $1/eg;
You should've posted some examples. Then again, Perlmonks likes to mangle non-ASCII symbols.

Replies are listed 'Best First'.
Re^2: Reversing Arabic String direction
by LanX (Saint) on Jul 10, 2014 at 22:41 UTC
    building on this, you'll need a second reverse and substitute numbers only

    DB<136> $str ="a123bc45de" => "a123bc45de" DB<137> $str2= reverse $str => "ed54cb321a" DB<138> $str2 =~ s/(\p{N}+)/reverse $1/ge => 2 DB<139> $str2 => "ed45cb123a"

    \p{N} is a guess, I'll check now¹! :)

    update

    changed order of inversion to make it clearer.

    Cheers Rolf

    (addicted to the Perl Programming Language)

    ¹) perlre only mentions \p{Digit} and \p{isDigit} ... both work for me.

      Genius! ;)
Re^2: Reversing Arabic String direction
by Anonymous Monk on Jul 10, 2014 at 22:16 UTC
    (should be) use open qw(:encoding(utf-8) :std);
      Actually, it appears you want to reverse the whole string, rather then word-by-word. Then it wouldn't work.