my $obj1 = new Obj; my $obj2 = new Obj; ## The two objects above are now equal, let's say. ## Serialize them, then compare the serialized ## data. use Storable qw/freeze/; if (freeze($obj1) eq freeze($obj2)) { ## They're the same. }