Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

prototype

Returns the prototype string of a subroutine, or undef if none.

Accepts a code reference, a reference to a CV, or a string naming the subroutine. For CORE:: builtins, returns the well-known prototype from a built-in table (e.g. \@@ for push, ;$ for defined). For user-defined subs, looks up the CV in the stash and returns its prototype. Unqualified names are resolved in the current package. Returns undef when the subroutine has no prototype or cannot be found.

Synopsis

my $proto = prototype(\&mysub);         # "$$"
my $proto = prototype('CORE::push');    # "\@@"
my $proto = prototype('main::func');    # look up by name

See Also

sub, CORE::