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 determinedReturns:
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 $$