Perl | prototype() Function
prototype() function in Perl returns a string containing the prototype of the function or reference passed to it as an argument, or undef if the function has no prototype.
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
Example 1:
$prototype_func = prototype ( "GFG" );
print "Prototype of GFG function " ,
"is $prototype_func\n" ;
sub GFG(**)
{
print "Just a statement\n" ;
}
|
Output:
Prototype of GFG function is **
Example 2:
$prototype_func = prototype ( "GFG" );
print "Prototype of GFG function " ,
"is $prototype_func\n" ;
sub GFG($$)
{
print "Just a statement\n" ;
}
|
Output:
Prototype of GFG function is $$
Last Updated :
28 Feb, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...