use Scalar::Util qw( reftype ); ... print "$ref is a ", reftype( $ref ), "\n";