Strawberry Perl 无法识别 OSNAME 的特殊变量
Strawberry Perl not recognising special variable for OSNAME
我最近在我的 PC 上将 Strawberry Perl 从版本 5.14.1.1-32 位升级到 5.24.0-64 位 运行ning Windows 7. 我有一个 perl 脚本 运行在 Windows 和 Linux 下,当我使用旧版本时命令
use if $^O eq 'MSWin32' , 'Win32::Console::ANSI';
成功了,但现在我已经升级了,我收到了错误消息
Unrecognized character \x0F; marked by <-- HERE after use if $<-- HERE near column9 at p:\bin\abc.pl line 31.
有谁知道发生了什么变化,我怎样才能让新版本的 Strawberry Perl 接受命令?预先感谢所有回复的人。
您的代码包含 Shift In control character (0x0F), also known as "Control-O", instead of the characters ^
and O
. This works in older versions of Perl but was deprecated in version 5.20.0:
Literal control characters in variable names
This deprecation affects things like $\cT, where \cT is a literal control (such as a NAK
or NEGATIVE ACKNOWLEDGE
character) in the source code. Surprisingly, it appears that originally this was intended as the canonical way of accessing variables like $^T, with the caret form only being added as an alternative.
The literal control form is being deprecated for two main reasons. It has what are likely unfixable bugs, such as $\cI not working as an alias for $^I, and their usage not being portable to non-ASCII platforms: While $^T will work everywhere, \cT is whitespace in EBCDIC. [perl #119123]
As of 5.24.0,使用包含非图形 ASCII 控制字符的变量名会导致语法错误。
我最近在我的 PC 上将 Strawberry Perl 从版本 5.14.1.1-32 位升级到 5.24.0-64 位 运行ning Windows 7. 我有一个 perl 脚本 运行在 Windows 和 Linux 下,当我使用旧版本时命令
use if $^O eq 'MSWin32' , 'Win32::Console::ANSI';
成功了,但现在我已经升级了,我收到了错误消息
Unrecognized character \x0F; marked by <-- HERE after use if $<-- HERE near column9 at p:\bin\abc.pl line 31.
有谁知道发生了什么变化,我怎样才能让新版本的 Strawberry Perl 接受命令?预先感谢所有回复的人。
您的代码包含 Shift In control character (0x0F), also known as "Control-O", instead of the characters ^
and O
. This works in older versions of Perl but was deprecated in version 5.20.0:
Literal control characters in variable names
This deprecation affects things like $\cT, where \cT is a literal control (such as a
NAK
orNEGATIVE ACKNOWLEDGE
character) in the source code. Surprisingly, it appears that originally this was intended as the canonical way of accessing variables like $^T, with the caret form only being added as an alternative.The literal control form is being deprecated for two main reasons. It has what are likely unfixable bugs, such as $\cI not working as an alias for $^I, and their usage not being portable to non-ASCII platforms: While $^T will work everywhere, \cT is whitespace in EBCDIC. [perl #119123]
As of 5.24.0,使用包含非图形 ASCII 控制字符的变量名会导致语法错误。