Meta-Information
Call-stack information. Use
caller()
to find out who’s calling this subroutine:($package, $file, $line) = caller();
List of a package’s global variables. For a package
Foo
,%Foo::
contains the symbol table, whose keys are names of global identifiers in that package and whose values are typeglobs.Find out what a reference contains.
ref($r)
returnsundef
if$r
is an ordinary scalar, “SCALAR” if it is a reference to a scalar (similarly “ARRAY,” “HASH,” “CODE,” and “REF”) or the name of a package, if$r
is a blessed object reference.Object information:
$obj->isa("Foo"); # returns true if $obj inherits from Foo $obj->can("bar"); # returns true if it supports method "bar"
Get Advanced Perl Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.