Is not a good way to find out if a variable is a reference to a Complex or not. The better way is UNIVERSAL::isa(). Every OO class inherits from UNIVERSAL, and so you can always call $object->isa(), like this: