Re: how to know the object type

2007-04-04 Thread Ovid
--- Jeff Pang <[EMAIL PROTECTED]> wrote: > > > >If I'm not mistaken, all Perl objects are references to a hash. > > > > Not correct at all. > Perl objects can be anything that's the blessed references. This is correct. It's another reason why you don't want to care about what data structure

Re: how to know the object type

2007-04-03 Thread Jeff Pang
If I'm not mistaken, all Perl objects are references to a hash. Not correct at all. Perl objects can be anything that's the blessed references. You can say any the below: sub new { my $class = shift; my $var = 'foo'; bless \$var,$class; } sub new { my $class = shift; my %h

Re: how to know the object type

2007-04-03 Thread Chad Kemp
Anish Kumar K wrote: Hi In java we have instance operator to tell the type of Object. Similarly in perl say I am passing a reference object to a function, Is it possible to detect in the function whether the object is HASH or ARRAY... Thanks Anish Hello Anish... If I'm not mistaken, al

Re: how to know the object type

2007-04-03 Thread Ovid
--- Anish Kumar K <[EMAIL PROTECTED]> wrote: > Hi > In java we have instance operator to tell the type of Object. > > Similarly in perl say I am passing a reference object to a function, > > Is it possible to detect in the function whether the object is HASH > or ARRAY... If you need to know th

RE: how to know the object type

2007-04-03 Thread Thomas Bätzler
Anish Kumar K <[EMAIL PROTECTED]> > In java we have instance operator to tell the type of Object. > > Similarly in perl say I am passing a reference object to a function, > > Is it possible to detect in the function whether the object > is HASH or ARRAY... The function "ref" does what you want.

Re: how to know the object type

2007-04-03 Thread Martin Barth
Anish Kumar K schrieb: > Hi > In java we have instance operator to tell the type of Object. > > Similarly in perl say I am passing a reference object to a function, > > Is it possible to detect in the function whether the object is HASH or > ARRAY... > > Thanks > Anish > Hi, try this: ref($va