in reply to Looping through arrays : are they equal ?
I would code your error checking in a way that gave you meaningful error messages:
use strict; use warnings; my $refcomp = { 'Ad1' => [qw(0A78 0A9E 0AB9 0AC0)], 'Ad2' => [qw(0A78 0A9E 0AB9 0AC0)], }; my %devs; for my $key (keys %$refcomp) { for (@{$refcomp->{$key}}) { $devs{$_}{$key}++; } } while (my ($dev, $keys) = each %devs) { if (my @notfound = sort grep {! $keys->{$_}} keys %$refcomp) { warn "$dev not found in: " . join(',', @notfound) . "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Looping through arrays : are they equal ?
by ZlR (Chaplain) on Apr 23, 2011 at 13:12 UTC |