这是由 s2p 生成的程序的一部分,该程序构建了一个执行特定 sed
命令的 perl 脚本。
# getsARGV: Read another input line into argument (default: $_).
# Move on to next input file, and reset EOF flag $isEOF.
sub getsARGV(;\$){
my $argref = @_ ? shift() : \$_;
while( $isEOF || ! defined( $$argref = <ARG> ) ){
close( ARG );
return 0 unless @ARGV;
my $file = shift( @ARGV );
open( ARG, "<$file" )
|| die( "$0: can't open $file for reading ($!)\n" );
$isEOF = 0;
}
1;
}
我在 perlsub 上找不到任何解释这个子签名的内容。
该代码也能很好地工作。
最佳答案
这是一个prototype .该特定原型(prototype)强制解析器仅接受用法
getsARGV()
和
getsARGV($SCALAR)
并使它们被编译为
&getsARGV()
和
&getsARGV(\$SCALAR)
关于Perl:子声明的 arg 列表中的 ;\$ 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16116572/