Perl prototype Function


Advertisements


Description

This function returns a string containing the prototype of the function or reference specified by EXPR, or undef if the function has no prototype.

You can also use this to check the availability of built-in functions.

Syntax

Following is the simple syntax for this function −

prototype EXPR

Return Value

This function returns undef if no function prototype else returns string containing the prototype of the function or reference specified by EXPR.

Example

Following is the example code showing its basic usage −

#!/usr/bin/perl -w

$func_prototype = prototype ( "myprint" );
print "myprint prototype is $func_prototype\n";

sub myprint($$){
  print "This is test\n";
}

When above code is executed, it produces the following result −

myprint prototype is $$


Advertisements