foreach my $network (@filtered_networks) { my $href; $href->{node} = $node->{hostname}; $href->{port} = $network->{interface}; unless ($href ~~ @ret_array) { push (@ret_array, $href); } }