Use reftype from Scalar::Util.
In reply to Re: Determining the true type of a reference by adrianh in thread Determining the true type of a reference by Mr. Muskrat