foreach my $host (@addresses) { system("ping -n 1 -4 $host > c:\\tmp\\$host"); }