Collate - compare 8-bit scalar data according to the current locale


use Collate; setlocale(LC_COLLATE, 'locale-of-your-choice'); $s1 = new Collate "scalar_data_1"; $s2 = new Collate "scalar_data_2";


This module provides you with objects that will collate according to your national character set, providing the POSIX setlocale() function should be supported on your system.

You can compare $s1 and $s2 above with

$s1 le $s2

to extract the data itself, you'll need a dereference: $$s1

This uses POSIX::setlocale. The basic collation conversion is done by strxfrm() which terminates at NUL characters being a decent C routine. collate_xfrm() handles embedded NUL characters gracefully. Due to cmp and overload magic, lt, le, eq, ge, and gt work also. The available locales depend on your operating system; try whether Cls /usr/nls/loc or CThe locale names are probably something like ``xx_XX.(ISO)?8859-N'' or ``xx_XX.(ISO)?8859N'', for example ``fr_CH.ISO8859-1'' is the Swiss (CH) variant of French (fr), ISO Latin (8859) 1 (-1) which is the Western European character set.