Example.
Sort::ArbBiLex
Sean M. Burke
"International Sorting with Perl's sort"
The Perl Journal, Summer 1999
 

Sort::ArbBiLex is a module in CPAN that automates the task of making routines that sort according to most types of special sort orders. Here's some example code that defines then uses a sort order for Spanish:

use strict;
use Sort::ArbBiLex;

*sort_es = Sort::ArbBiLex::maker(  # defines &sort_es
 "a A á Á  
  b B
  c C
  ch Ch CH
  d D 
  e E é É
  f F
  g G
  h H
  i I í Í
  j J
  k K
  l L
  ll Ll LL
  m M
  n N
  ñ Ñ
  o O ó Ó
  p P
  q Q
  r R
  s S
  t T
  u U ú Ú ü Ü
  v V
  w W
  x X
  y Y
  z Z
 "
);

my @stuff = ("cana", "caña", "cánula", "cantina",
             "Canal", "cantó", "canto", "cantor");

print map "[$_] ", sort_es(@stuff);

This code prints:

[cana] [Canal] [cantina] [canto] [cantó] [cantor] 
[cánula] [caña]