珀尔 |原型()函数
Perl 中的prototype()函数返回一个字符串,其中包含函数原型或作为参数传递给它的引用,如果函数没有原型,则返回undef。
Syntax: prototype(function_name)
Parameter:
function_name: Function whose prototype is to be determined
Returns:
prototype of the function passed or undef if no prototype exists
示例 1:
#!/usr/bin/perl -w
$prototype_func = prototype ( "GFG" );
print "Prototype of GFG function ",
"is $prototype_func\n";
sub GFG(**)
{
print "Just a statement\n";
}
输出:
Prototype of GFG function is **
示例 2:
#!/usr/bin/perl -w
$prototype_func = prototype ( "GFG" );
print "Prototype of GFG function ",
"is $prototype_func\n";
sub GFG($$)
{
print "Just a statement\n";
}
输出:
Prototype of GFG function is $$