# Create a list of all possible IP addresses within subnet open(ALLIP, ">allip.list") || die "Unable to create file: allip.list\n"; for ($i=0; $i<=20; $i++) { print ALLIP "$ip_subnet.$i\n"; } close(ALLIP); open(ALLIP, "allip.list") || die "Unable to open file: allip.list\n"; open(PINGALLIP, ">pingallip.list") || die "Unable to open file: pingallip.list"; while () { chomp; system("ping $_ >>pingallip.list") && "Unable to create file: pingallip. list"; } close(ALLIP); close(PINGALLIP); open(ALIVEIP, ">aliveip.list"); close(ALIVEIP); open(ALIVEIP, "aliveip.list"); open(PINGALLIP, "pingallip.list") || die "Unable to open file: pingallip.list"; while () { if (/is alive/) { chomp; print ALIVEIP $_; } } close(PINGALLIP);