Remove two warnings (sub diag() was redefined, and implict split is
[p5sagit/p5-mst-13.2.git] / ext / Encode / bin / ucmsort
CommitLineData
ab3374e4 1#!/usr/local/bin/perl
2#
d1256cb1 3# $Id: ucmsort,v 2.2 2006/05/03 18:24:10 dankogai Exp $
ab3374e4 4#
5use strict;
6my @lines;
7my ($head, $tail);
8while (<>){
9 unless (m/^<U/o){
10 unless(@lines){
d1256cb1 11 $head .= $_;
12 }else{
13 $tail .= $_;
14 }
15 next;
ab3374e4 16 }
17 chomp;
cf9f87ce 18 my @words = split;
19 my $u = shift @words;
20 $u =~ s/^<U//o; $u =~ s/>.*//o;
21 push @lines,[ $u, @words ];
ab3374e4 22}
23
24print $head;
25for (sort {
cf9f87ce 26 hex($a->[0]) <=> hex($b->[0]) # Unicode descending order
d1256cb1 27 or $a->[2] cmp $b->[2] # fallback descending order
28 or $a->[1] cmp $b->[1] # Encoding descending order
cf9f87ce 29 }
30 @lines) {
31 my $u = shift @$_;
32 print join(" " => "<U$u>", @$_), "\n";
ab3374e4 33}
34print $tail;
35__END__