in reply to Re: Objects as hash keys?
in thread Objects as hash keys?

Exactly, the feature. I feel that I can do more with Perl, after learning Ruby.
package Person; sub new { my $class = shift; my $self = {_name => shift}; bless $self, $class; } 1; package Computer; sub new { my $class = shift; my $self = {_name => shift}; bless $self, $class; } package MP3Player; sub new { my $class = shift; my $self = {_name => shift}; bless $self, $class; } 1; package main; $c1 = Computer->new("Dell"); $c2 = Computer->new("Apple"); $m1 = MP3Player->new("IPOD"); $p1 = Person->new("artist"); $p2 = Person->new("jdporter"); use Tie::RefHash; tie %gift, 'Tie::RefHash'; $gift{$p1} = [$c1]; $gift{$p2} = [$c2,$m1]; foreach my $person (keys %gift){ print "Person: ", $person->{_name},"\n"; foreach my $gift (@{$gift{$person}}){ print "Gift\t", ref $gift,"\t", $gift->{_name},"\n"; } }
--Artist