[Israel.pm] how to get the data type of blessed object
gaal at forum2.org
Tue Jul 13 11:47:34 PDT 2004
On Tue, Jul 13, 2004 at 08:46:38PM +0300, Itamar Elem wrote:
> > >how can i get the datatype(ARRAY,HASH,....) of blessed object
> >print ref $x;
> use attributes;
> print attributes::reftype $x;
Since attributes.pm is "still evolving", if you want this kind of
approach you'd better use Scalar::Util::reftype instead.
Mikhael suggests stringifying the reference, but as he himself notes
this is not robust against ""-overloading.
I usually use the ref builtin.
Gaal Yahas <gaal at forum2.org>
More information about the Perl