我最近在运行
Windows 7的PC上将Strawberry Perl从版本5.14.1.1-32bit升级到5.24.0-64bit.我有一个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控制字符(0x0F),也称为“Control-O”,而不是字符^和O.这适用于旧版本的Perl但是
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控制字符的变量名称会导致语法错误.