2
当我把我的locale
到it_IT.UTF-8
(出口LC_ALL = it_IT.UTF-8),并运行此脚本使用的语言环境 - 问题
#!/usr/bin/env perl
use warnings;
use 5.012;
use POSIX qw(strftime);
say strftime "%A %B %e %H:%M:%S %Y", localtime;
我得到这样的输出:
martedì marzo 15 08:50:07 2011
但阅读本(从The-use-locale-pragma):
By default, Perl ignores the current locale. The use locale pragma tells Perl to use the current locale for some operations: ... The POSIX date formatting function (strftime()) uses LC_TIME .
为什么我的语言环境设置对strftime输出有影响,而不使用locale
编译指示?
看来'POSIX'和语言环境只是Perl的一个黑暗的角落。另见http://stackoverflow.com/questions/3214418/is-locale-setting-global-in-perl – 2011-03-15 09:22:59