Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Perl compare strings under the hood?

Tags:

perl

Does Perl just compare the ASCII values of each character of each string until it can place one before the other or does the language compare strings in another way?

like image 458
Daniel Avatar asked Nov 12 '22 00:11

Daniel


1 Answers

Perl does take your current locale into account and uses the sort order defined by this locale. This does not only take charsets (such as ASCII) into account but also languages. For instance words are sorted differently in French than in German, etc…

like image 114
Christian Avatar answered Nov 15 '22 05:11

Christian