为什么我不能在Perl中设置$LIST_SEPARATOR?

前端之家收集整理的这篇文章主要介绍了为什么我不能在Perl中设置$LIST_SEPARATOR?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在perl中设置LIST_SEPARATOR,但我得到的就是这个警告:

Name "main::LIST_SEPARATOR" used only once: possible typo at ldapflip.pl line 7.

这是我的计划:

#!/usr/bin/perl -w

@vals;
push @vals,"a";
push @vals,"b";

$LIST_SEPARATOR='|';

print "@vals\n";

我确信我错过了一些明显的东西,但我没有看到它.

谢谢

解决方法

perlvar是你的朋友:

$LIST_SEPARATOR
$"

This is like $, except that it applies to array and slice values interpolated into a double-quoted string (or similar interpreted string). Default is a space. (Mnemonic: obvIoUs,I think.)

$LIST_SEPARATOR只有在您使用英语时才可用;如果你不想使用英语;在你的所有程序中,使用$“而不是.相同的变量,只是更简洁的名称.

猜你在找的Perl相关文章