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

This works on my system, (linux, so you'll need to tweak the locations of things), though it's a bit of a kludge.
#!/usr/bin/perl -w open NAMES, "names.txt" or die "Cannot open names file"; while (<NAMES>) { chomp; my $ping = `ping -c 1 $_`; if ($ping =~ /\((\d+\.\d+\.\d+\.\d+)\)/) { my $ip = $1; open TESTED, '>>tested.txt'; print TESTED "$ip\n"; close TESTED; } else { warn "Cannot deciper result of \"ping $_\""; } } close NAMES; exit 0;

Originally posted as a Categorized Answer.