note
AnomalousMonk
<p>
I'm not entirely sure I understand your requirement, but if I do, this might fill the bill:
</P>
<c>
>perl -wMstrict -MData::Dump -le
"my @subnets = (
{ qw(id 1 location_id 30 subnet 255.255.255.0) },
{ qw(id 2 location_id 13 subnet 255.255.254.0) },
{ qw(id 3 location_id 19 subnet 255.255.0.0 ) },
);
dd \@subnets;
;;
my @filers_info = (
{ qw(id 1 location_id 19 info blah1) },
{ qw(id 2 location_id 30 info blah1) },
{ qw(id 3 location_id 99 info yada1) },
);
dd \@filers_info;
;;
my %locations = map { $_->{location_id}, 1 } @subnets;
dd \%locations;
;;
my @filer_ids = grep $locations{ $_->{location_id} }, @filers_info;
dd \@filer_ids;
"
[
{ id => 1, location_id => 30, subnet => "255.255.255.0" },
{ id => 2, location_id => 13, subnet => "255.255.254.0" },
{ id => 3, location_id => 19, subnet => "255.255.0.0" },
]
[
{ id => 1, info => "blah1", location_id => 19 },
{ id => 2, info => "blah1", location_id => 30 },
{ id => 3, info => "yada1", location_id => 99 },
]
{ 13 => 1, 19 => 1, 30 => 1 }
[
{ id => 1, info => "blah1", location_id => 19 },
{ id => 2, info => "blah1", location_id => 30 },
]
</C>
1001725
1001725