Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Perl | prototype() Function

  • Last Updated : 28 Feb, 2019

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:




#!/usr/bin/perl -w
  
$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:




#!/usr/bin/perl -w
  
$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 $$
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!