#!/usr/bin/perl use strict; use warnings; use IO::Socket::INET; my @ports = qw/20 29 80 99/; my @ips = ("www.example.org", "example.com" ) ; for my $i (@ips) { for my $p(@ports) { print "Connect to $i:$p", "\n"; my $socket = IO::Socket::INET->new( PeerAddr => $i, PeerPort => $p, proto => 'tcp', Timeout => 0 ); print "$i:$p ", $socket ? "ist verbunden" : "#Fehler: $@#", "\n"; $socket && $socket->close(); } } 1;