in reply to Re^2: Spanish locale and name sorting
in thread Spanish locale and name sorting
Down and dirty hacks are available of course. For everyday use I have come up with this:
#!/usr/bin/perl use locale; my @list = ('maceira', 'mac alister', 'mac loughlin', 'san esteban', ' +sangregorio', 'san zoilo'); sub keeping_spaces { my $aa = $a; my $bb = $b; for ($aa) { tr/ /A/; } for ($bb) { tr/ /A/; } return $aa cmp $bb; } print "$_\n" for sort keeping_spaces @list;
Which outputs what we would expect:
mac alister mac loughlin maceira san esteban san zoilo sangregorio
In Section
Seekers of Perl Wisdom