gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 01:03:33 30 4
gpt4 key购买 nike

我想在 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";

我确定我遗漏了一些明显的东西,但我没有看到。

谢谢

最佳答案

只有助记符可用

$" = '|';

除非你
use English;

第一的。

perlvar 中所述.请阅读文档。

The following names have special meaning to Perl. Most punctuation names have reasonable mnemonics, or analogs in the shells. Nevertheless, if you wish to use long variable names, you need only say

use English;

at the top of your program. This aliases all the short names to the long names in the current package. Some even have medium names, generally borrowed from awk. In general, it's best to use the

use English '-no_match_vars';

invocation if you don't need $PREMATCH, $MATCH, or $POSTMATCH, as it avoids a certain performance hit with the use of regular expressions. See English.

关于perl - 为什么我不能在 Perl 中设置 $LIST_SEPARATOR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/711222/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com