Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Set modules and object comparison

by suaveant (Parson)
on Sep 17, 2007 at 19:19 UTC ( [id://639464]=note: print w/replies, xml ) Need Help??


in reply to Set modules and object comparison

Should be relatively easy to code yourself...
sub object_set { my($lista,$listb) = @_; my(%seen,%seen2); for(@$lista) { push @{$seen{$_->id}}, $_; } for(@$listb) { if($seen{$_->id}) { push @{$seen2{$_->id}}, @{delete($seen{$_->id})}, $_; } elsif($seen2{$_->id}) { push @{$seen2{$_->id}}, $_; } else { push @{$seen{$_->id}}, $_; } } return { diff => \%seen, int => \%seen2 }; }
Not tested, but the idea is there and easily tweaked. Since you don't want to use refaddrs I assume you can have multiple references that have the same id, so I pushed them onto an array to catch them all. Hope that helps.

                - Ant
                - Some of my best work - (1 2 3)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 11:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found