Name

can

Synopsis

$sub = $obj->can(method)

Checks if object $ objhas a method method. If so, returns a reference to the subroutine; otherwise, returns undef. Can be called as a static or object method call, or as a subroutine:

$ref = UNIVERSAL::can(val, method)

Returns a reference to the subroutine if val is a blessed reference with a method method, and undef if val is not blessed or does not have method.

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.