in reply to issues maintaining uniqueness
My assumptions are:
a) $urls will inherit only the unique elements of the @hrefs array
That's your mistake. When you iterate over an array using for, the indexing variable ($urls) will take on each value in turn regardless of whether it is unique or not.
The simplest way to ensure uniqueness (assuming that ordering is not important to your application) is to use a hash.
my @hrefs = ...; my %uniqHrefs; ### This will create one entry in %uniqHrefs for each unique value in +@hrefs; @uniqHrefs{ @hrefs } = (); my $res = Net::DNS::Resolver->new; foreach $urls ( keys %uniqHrefs ) { my $query = $res->query($urls, "A"); ...
If you need to retain ordering, then you'll need something slightly different but that doesn't seem to be the case.
|
|---|