sub checkports { my $sock; my ($pop, $smtp, $ftp) = @_; DEBUG && print "Checking ports : "; my %ports = ( 110 => $pop, 25 => $smtp, 21 => $ftp ); for my $port (keys %ports) { DEBUG && print "[$port] "; $sock = new IO::Socket::INET(PeerAddr => $ports{$port}, PeerPort => $port, Proto => 'tcp', Timeout=>10); if ($sock) { $client->{"PORT$port"} = 'U'; close $sock; } else { $client->{"PORT$port"} = 'D'; } } DEBUG && print " done.\n"; }