in reply to how do I test against each element in an array

If you are trying to get the IP vs hostname, I would suggest using Socket and inet_ntoa(scalar(gethostbyname($host)));

So, something like this (untested):
use strict; use Socket; my $ip; open (NAMES, "<c:/names.txt") || die "Could not open c:/names.txt: $!" +; my @hosts=<NAMES>; close NAMES; chomp (@hosts); open (IPS, ">someoutputfile.txt") || die "Could not create file: $!"; foreach (@hosts){ $ip = inet_ntoa(scalar(gethostbyname($_))); print IPS "$_\n"; } close IPS;

Originally posted as a Categorized Answer.