Strawberry Perl无法识别OSNAME的特殊变量

前端之家收集整理的这篇文章主要介绍了Strawberry Perl无法识别OSNAME的特殊变量前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近在运行 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 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控制字符的变量名称会导致语法错误.

猜你在找的Perl相关文章