(This message uses special characters, which may be displayed incorrectly on your system:
Thanks for understanding.)
Hi,
I'm writing a Perl program that processes a text in the Lithuanian language.
Lithuanian uses the Latin alphabet with some modifications. One of the curious properties of this language is the alphabetic order. There are three variations of the letter I: I, Y and Į (the last one is supposed to look like an I with a tail). They are considered as one and the same letter when words are sorted alphabetically, so the Y doesn't come between X and Z and not even between I and J, but is mixed with I. For example, the following list is taken straight from a dictionary. :
As you see, these words are sorted as if they were all written with an I.
As far as i understand, Perl's sort function uses the locale to determine the collation order. I'm trying to set a Lithuanian locale by saying
... And then i run:use locale; use POSIX; setlocale(LC_ALL, 'lt');
my @sorttest = qw(ia ib ic ya yb yc); for (sort @sorttest) { print "$_\n"; }
According to Lithuanian rules this should have printed:
ia
ya
ib
yb
ic
yc
... but instead it prints:
ia
ib
ic
ya
yb
yc
Am i doing something wrong? Or maybe Perl just doesn't know about the different locales? Or maybe Perl is supposed to know, but it is a bug?
I tried the above code with ActivePerl 5.8.8 build 820 on Windows XP SP2 and with Perl 5.8.0 on Red Hat Enterprise Linux kernel 2.4.21 (i'm not sure which version of RHEL exactly it is). The results were the same.
Thanks in advance for any help.
In reply to Sorting according to locale collation by amir_e_a
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |