in reply to Compare variables when the number of them vary

I expect that really the only test you want to perform on the list of SOAs for a single domain is whether or not they are all the same. If there are any differences then that should be treated as a problem.

So, instead of your test being if ($serials[0] == $serials[1]) try instead finding how many unique values are in the list, eg.

use List::MoreUtils qw/uniq/; if (scalar (uniq @serials) == 1) { say $resultsfh join (',', 'MATCH', $fqdn, @serials); } else { say $resultsfh join (',', 'MISMATCH', $fqdn, @serials); push @errors, join (',', 'MISMATCH', $fqdn, @serials); }