我想知道是否有可能在perl这里调用一个函数doc
sub Function
{
}
print<<HERE;
Function()
HERE
Run Code Online (Sandbox Code Playgroud)
eph*_*ent 18
你的意思是你想要将函数的返回值插入到heredoc中吗?
sub Function {
qw( Hello, World! );
}
print <<HERE;
@{[ Function() ]}
HERE
Run Code Online (Sandbox Code Playgroud)
为了解释语法,perlmonks说:
将@{}数组插入到here-doc中,内部[]创建一个匿名数组,其元素由要放在它们之间的任何表达式组成.