package MyObj; sub new { bless {}, shift; } 1; --- #!/usr/bin/perl -w use MyObj; my %hash; my $a = MyObj->new(); my $b = MyObj->new(); $hash{$a} = "This is my Object A"; $hash{$b} = "This is my Object B"; print $a, "\n"; print $b, "\n"; print $_, " : ", $hash{$_}, "\n" foreach keys %hash; __END__ MyObj=HASH(0x2001b1fc) MyObj=HASH(0x2001b2e0) MyObj=HASH(0x2001b1fc) : This is my Object A MyObj=HASH(0x2001b2e0) : This is my Object B