On Aug 7, Qiang Qiang said:

>Who knows how to compare two references (pointers) in OOPerl?  A reference 
>is neither a numeric or a string, thus "==" and "eq" are useless.  Of 
>course, I can use what they point at (the objects) to compare, however, I 
>want to know how to deal with references.  Thanks a lot:-)

Your argument about == and eq is wrong.  References behave specially in
numeric context, and are "stringified" in string context.  Unless an
object is overloaded, you can do:

  $addr = $obj + 0;

and

  $info = "$obj";

and get useful information.  You can compare two references numerically,
and find out if they reference to the same place in memory.  Recent
versions of Perl have (thankfully) documented this in the perlref man
page.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to