Name

ref

Synopsis

ref $var
                  

Returns a string indicating the type of the object referenced if var is a reference; returns the null string otherwise. Built-in types include:

REF
SCALAR
ARRAY
HASH
CODE
GLOB

If the referenced object has been blessed into a package, that package name is returned instead. You can think of ref as a “typeof” operator.

Get Perl in a Nutshell, 2nd Edition 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.