tart has asked for the wisdom of the Perl Monks concerning the following question:
sub compareProgram { my $manifest1HR = shift; my $manifest2HR = shift; my $main1AR = $manifest1HR->{MAIN}; my $main2AR = $manifest2HR->{MAIN}; foreach my $attr1HR(@$main1AR) { next unless($attr1HR->{Program}); foreach my $attr2HR(@$main2AR) { next unless($attr2HR->{Program}); if($attr1HR->{Program} eq $attr2HR->{Program} and $attr1HR->{File} eq $attr2HR-> +{File}) { if($attr1HR->{Size} ne $attr2HR->{Size}) { print "1: $attr1HR->{Program}\n"; print "1: $attr1HR->{File}\n"; print "1: $attr1HR->{Size}\n"; print "2: $attr2HR->{Size}\n"; } last; } } } }
$VAR1 = { 'MAIN' => [ { 'Program' => 'EXECUTE', 'Size' => '1302267', 'File' => 'help.txt' }, { 'Program' => 'RUN', 'Size' => '15042454', 'File' => 'help.txt' }, { 'Program' => 'RUN', 'Size' => '387469', 'File' => 'run.exe' }, { 'Program' => 'PIPE', 'Size' => '34010402', 'File' => 'run.exe', } ] }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Slow Comparison
by GrandFather (Saint) on Nov 30, 2010 at 03:25 UTC | |
by tart (Beadle) on Nov 30, 2010 at 03:47 UTC | |
by GrandFather (Saint) on Nov 30, 2010 at 04:19 UTC |