相关疑难解决方法(0)

Perl 5中存在哪些伪运算符?

我目前正在记录所有Perl 5的运算符(参见perlopref GitHub项目),我也决定包含Perl 5的伪运算符.对我来说,Perl中的伪运算符是任何看起来像运算符的东西,但实际上不仅仅是一个运算符或其他一些语法.我已经记录了我熟悉的四个:

  • ()= 算子的数量
  • =()= goatse/countof运算符
  • ~~ 标量上下文运算符
  • }{ 爱斯基摩吻操作员

这些伪运算符还有哪些其他名称,你知道我错过了哪些伪运算符吗?

=head1 Pseudo-operators

There are idioms in Perl 5 that appear to be operators, but are really a
combination of several operators or pieces of syntax. These pseudo-operators
have the precedence of the constituent parts.

=head2 ()= X

=head3 Description

This pseudo-operator is the list assignment operator (aka the countof
operator).  It is made up of two items C<()>, and C<=>.  In scalar context
it returns the …
Run Code Online (Sandbox Code Playgroud)

perl operators

27
推荐指数
2
解决办法
1482
查看次数

为什么@ARGV在这个Perl单行内部未定义?

一个家伙Stackoverflower 试图@ARGV在他的END街区使用,但无法.

为什么@ARGVBEGIN使用以下单行在块内定义:

$ perl -lne 'BEGIN{ print "BEGIN"  if @ARGV }
                    print "MIDDLE" if @ARGV }
                  { print "END"    if @ARGV  ' file
  BEGIN
Run Code Online (Sandbox Code Playgroud)

perldoc perlrun对此事没有任何启示.这里发生了什么?

perl

4
推荐指数
1
解决办法
1299
查看次数

标签 统计

perl ×2

operators ×1