in reply to how do I test against each element in an array
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.
|
|---|