Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: A simple Comparison

by btrott (Parson)
on Jun 30, 2000 at 21:11 UTC ( [id://20628]=note: print w/replies, xml ) Need Help??

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.
        }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://20628]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-18 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found