strxfrm#

Locale-transformed form of a string, for repeated collation.

Synopsis#

use POSIX qw(strxfrm);
my @sorted = map { $_->[1] }
             sort { $a->[0] cmp $b->[0] }
             map { [ strxfrm($_), $_ ] } @words;

What you get back#

A byte string whose plain cmp ordering equals strcoll’s ordering of the originals under the current LC_COLLATE locale. Worth it when the same string is compared many times, as in a sort.

Differences from upstream#

Fully compatible with upstream POSIX.