Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: compare two reference in perlway

by mr_ron (Chaplain)
on Oct 19, 2015 at 14:15 UTC ( [id://1145329]=note: print w/replies, xml ) Need Help??


in reply to compare two reference in perlway

Besides Data::Compare proposed by Eily, there are also Data::Walk and Data::Walker. When you put it together the problem seems to have a reasonably simple and neat solution:

use strict; use warnings; use Data::Walk; use Data::Compare; sub find_structure_part { my $search_space = shift; my $target = shift; my $found = 0; walk sub { if (not $found and Compare($_, $target)) { $found = 1 } }, $search_space; return $found; }
Ron

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found