Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Sorting according to locale collation

by amir_e_a (Hermit)
on Apr 22, 2007 at 13:07 UTC ( [id://611359]=note: print w/replies, xml ) Need Help??


in reply to Re: Sorting according to locale collation
in thread Sorting according to locale collation

Check what locale settings are installed/available to you in the working environment (perllocale suggests a number of ways to do that)

I tried `locale -a' on Linux, and found out that it doesn't have 'lt', but it does have lt_LT, which should be the same. (It also has 'lithuanian' ... Is it a standard in Unix or some GNU extension?)

Anyway, i tried running this:

use strict; use warnings; use locale; use POSIX; my $loc = setlocale(LC_ALL, 'lt'); if (defined $loc) { print "loc is defined\n"; print "loc value: *$loc*\n"; } else { print "loc is undefined\n"; } my @sorttest = qw(ia ib ic ya yb yc); for (sort @sorttest) { print "$_\n"; }

When i try 'lt_LT', $loc is 'lt_LT'. When i try 'lt', $loc is undefined, so i must be in the right direction.

However, the sorting still doesn't work as i would expect Can it really be a bug in Linux?

Also, perllocale suggests only Unix'ish ways to list available locales. Is there anything like `locale -a' on Windows? I'm trying to be portable.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://611359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-28 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found