use utf8; use open qw(:encode(utf-8) :std); ... $arabic_string =~ s/(\p{L}+)/reverse $1/eg;