调用 Perl 时避免出现“Setting Locale Failed”消息

nev*_*int 1 unix linux perl message stderr

每当我运行我的代码时:

$perl my_any_code.pl 
Run Code Online (Sandbox Code Playgroud)

它总是给我这个:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Run Code Online (Sandbox Code Playgroud)

我怎样才能避免这种情况?

cjm*_*cjm 6

UTF-8不是区域设置名称。LC_CTYPE将环境变量设置为系统可以识别的区域设置。它应该看起来像en_US.UTF-8。您可以通过运行命令来获取有效区域设置的列表locale -a