#!/usr/local/bin/perl # # $Id: ucmsort,v 1.3 2005/01/15 21:30:26 millert Exp $ # use strict; my @lines; my ($head, $tail); while (<>){ unless (m/^.*//o; push @lines,[ $u, @words ]; } print $head; for (sort { hex($a->[0]) <=> hex($b->[0]) # Unicode descending order or $a->[2] cmp $b->[2] # fallback descending order or $a->[1] cmp $b->[1] # Encoding descending order } @lines) { my $u = shift @$_; print join(" " => "", @$_), "\n"; } print $tail; __END__