Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Sorting Vietnamese text

by Atacama (Sexton)
on Dec 23, 2013 at 00:35 UTC ( #1068130=note: print w/replies, xml ) Need Help??


in reply to Re^2: Sorting Vietnamese text
in thread Sorting Vietnamese text

moritz basically implemented a similar idea (that I formulated incorrectly in my message, btw). I think it will be better to use the unicode collation module advised above.
#!/usr/bin/env perl use warnings; use strict; use Sort::External; use Unicode::Collate::Locale; my $in = shift // 'large-unsorted.txt'; my $out = shift // 'sorted.txt'; my $comparator = Unicode::Collate::Locale->new(locale =>'vi'); my $sorter = Sort::External->new ( sortsub => sub { $comparator->cmp($Sort::External::a, $Sort::Externa +l::b) } ); open my $unsorted, '<', $in or die $!; $sorter->feed($_) while <$unsorted>; $sorter->finish(outfile => $out);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1068130]
help
Chatterbox?
[james28909]: how come it is so easy for me to not care what others think while others will mute themselves because they are scare they will be called ignorant or stupid

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2017-12-15 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (433 votes). Check out past polls.

    Notices?