setlocale#

Query or change the program’s locale setting.

תקציר#

use POSIX qw(setlocale LC_ALL LC_NUMERIC);
setlocale(LC_ALL, "");              # honour environment
my $cur = setlocale(LC_NUMERIC);    # query current

מה מוחזר#

The resulting locale name as a string, or undef if the category/locale combination is invalid. Calling with one argument queries; calling with two sets. Passing "" as the new locale asks libc to pick from LC_* / LANG environment variables.

מקרי קצה#

  • Changing a category can affect formatting of numbers, collation, date strings, and error messages throughout the process.

הבדלים מן ה-upstream#

Fully compatible with upstream POSIX.

ראו גם#

  • localeconv - inspect the active locale’s numeric and monetary conventions.