if (ref $var eq 'SCALAR') { print "scalar\n"; } elsif (ref $var eq 'ARRAY') { print "array\n"; } elsif (ref $var eq 'HASH') { print "hash\n"; }