%a = ('a','b'); varType(\%a); sub varType { # we are supplying a HASH local ($var) = @_[$[]; # $var is now a HASH. print "ref type is:".ref(\$var); # "ref type is ref" #wrong print "ref type is:".ref(\%$var); # "ref type is HASH" #correct # It only works if I tell ref() that $var is a %hash. # But the whole point of the subroutine is that I do not know what the data type is. # So how can I find out? }