A method of class UNIVERSAL (which see for notes on availability and use; basically it's available on all objects). $x->can('foo') checks if $x "can" foo, that is whether $x->foo is a legal method call (taking inheritance into account, of course).

can returns the code reference of the method which $x->foo would call, or undef if $x can't (sorry) foo. As such, can is often used for this particular return value, to get a grip on the method's code reference.