$ping = `ping $host`; $nslookup = `nslookup $host`; #### foreach my $host (@hosts) { $ping = `ping $host`; $nslookup = `nslookup $host'; print "Ping result is $ping \n"; print "Nslookup result is $nslookup for host $host \n"; }