if (!ref $param) { # scalar } elsif ($param->can('readline')) { # who knows what it is? But it supports a readline method ... } else { ... }