Help for this page

Select Code to Download


  1. or download this
        my $obj1 = new Obj;
        my $obj2 = new Obj;
    ...
        if (freeze($obj1) eq freeze($obj2)) {
            ## They're the same.
        }
    
  2. or download this
        package Obj;
        use Storable qw/freeze/;
        use overload '==' => \&compare;
    
        sub compare { return freeze($_[0]) eq freeze($_[1]) }
    
  3. or download this
        if ($obj1 == $obj2) {
            # They're the same.
        }