Date: Thu, 9 Dec 1999 14:50:52 +0500 (YEKT) From: Nikita Shamgunov <nsh@dream.mplik.ru> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/15370: bug in sort Message-ID: <199912090950.OAA38153@dream.mplik.ru>
index | next in thread | raw e-mail
>Number: 15370
>Category: bin
>Synopsis: bug in sort
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 9 02:00:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Nikita Shamgunov
>Release: FreeBSD 3.3-STABLE i386
>Organization:
URAL RELCOM
>Environment:
perl locale KOI8-R
>Description:
Проблемы с сортировкой массивов русских слов без
различений регистра.
>How-To-Repeat:
#!/usr/bin/perl
use strict;
use locale;
use POSIX qw( locale_h );
setlocale( LC_ALL, 'KOI8-R' );
my @array;
while( <DATA> ) {
next if( /^#/ );
s/\s*(\S+)\s*/$1/;
push( @array, $_ );
}
#
# Если поставить эту строку то сортирует верно lc - в нижний регистр
# my @array1 = sort {lc1($a) cmp lc1($b)} @array;
#
#
# Неверно сортирует
my @array1 = sort {lc($a) cmp lc($b)} @array;
# Выводим результат
print join( "\n", @array1 );
sub lc1 {
my $str = shift;
$str =~ tr/АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ/абвгдежзиклмнопрстуфхцчшщъыьэюя/;
return $str;
}
__DATA__
ДДТ
Дистемпер
Дельфин
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912090950.OAA38153>
