Perl 的 $ 是多少?变量为?
有谁知道以下代码片段中的 $;
(第一个分割函数参数)是什么:
local(@a) = ();
local($i) = 0;
for ($i = 0; $i < $d; $i++) {
@a = split($;, @b[$i]);
$c = @a[0];
}
除了 for 循环之外,在脚本中的任何位置都找不到标量。
任何帮助表示赞赏。
Does any 1 have any idea what is $;
(first split function argument) in the following code snippet:
local(@a) = ();
local($i) = 0;
for ($i = 0; $i < $d; $i++) {
@a = split($;, @b[$i]);
$c = @a[0];
}
The scalar is not found any where in the script other than in the for loop.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Perl 的特殊变量记录在
perlvar
中,包括$ ;
我们可以猜测为什么要使用它(例如,也许
@b
包含一些散列的键),但是知道@b
是如何创建的会让我们提供更有帮助的答案。另请注意,
@b[$i]
和@a[0]
可能应该是and
。使用前导
@
时,它们是单元素数组切片,但使用$
时,它们是简单标量。Perl's special variables are documented in
perlvar
, including$;
We could guess about why it's being used (e.g., maybe
@b
contains some hash's keys), but knowing how@b
is created would let us provide more helpful answers.Note also that
@b[$i]
and@a[0]
should probably beand
instead. With the leading
@
, they're single-element array slices, but with$
, they're simple scalars.Perl 特殊变量在 perlvar 中列出。
The Perl special variables are listed in perlvar.