use Scalar::Util (); sub reftype ($) { return '' if !defined $_[0]; return Scalar::Util::reftype($_[0]); }