in reply to HASH question

First, in Perl, when you print a HASH ref, what you get will be HASH(0xaddr). You can interprete this as the address where the content of the HASH resides. Secondly, in Perl, a class is actually stored as a HASH, so there is no surprise to see HASH(0xaddr) being a part of your print out, when you print the object. The first part, I mean the portion before the = sign, is the "name" of the class. Third, see this helps the programer a lot, you can determine the type of the object, by simply look at what stored in its ref. This is very powerful. It makes possible for you to have functions take generic objects, and then base on the type of the objects to determine how to deal with them. There are times that you want to process apple as apple, and orange as orange, but you may some times receive apple and some times orange.

Replies are listed 'Best First'.
Re: Re: HASH question
by Jenda (Abbot) on Nov 11, 2002 at 22:38 UTC

    Object doesn't have to be a hash reference. It may be an array ref, a scalar ref, a glob ref ...

    Hashes are just most common.

    Jenda