tom arnall wrote: > the following code: > > #!/usr/bin/perl -w > use strict; > use POSIX qw(locale_h); > my ($f,@f,$g); > setlocale(LC_COLLATE, "es_ES.ISO-8859-1"); > @f = qw(oval óvalo zurrir); > print "before sort:@f > "; > @f = sort @f; > $f = setlocale(LC_COLLATE); > print "after sort:@f > locale *after* setlocale statement: $f > !!!??? > "; > > produces: > > before sort:oval óvalo zurrir > after sort:oval zurrir óvalo > locale *after* setlocale statement: en_US > !!!??? > > why is 'óvalo' following 'zurrir' after the sort?? i.e., why is the setlocale > statement not working? the locale seems to be set up properly on my system > (debian linux), i.e., i've got: > > /usr/share/i18n/locales/es_ES
You have to use the 'locale' pragma: $ perl -le' use locale; # MUST use this pragma!! use POSIX qw( locale_h ); setlocale( LC_COLLATE, "es_ES.ISO-8859-1" ); my @f = qw( oval óvalo zurrir ); print "before sort: @f"; @f = sort @f; print "after sort: @f"; ' before sort: oval óvalo zurrir after sort: óvalo oval zurrir perldoc locale perldoc perllocale John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>