in reply to Writing to File based on condition

Hi cbtshare,

two comments (assuming I understood what you're doing).

Don't open you output file for append each time through the loop, open it only once at the beginning and close it at the end. This will be more efficient.

Remove duplicate IPs from the @ips array before you start. There is no point testing whether the IP is alive if you've already found out, only to remove it afterwards if you've already checked that IP.