use IO::Socket::INET; $server = "irc.seilen.de"; $port = "6667"; $channel = "#bot"; $nick = "tK-Bot"; my $sock = new IO::Socket::INET( PeerAddr => $server, PeerPort => $port, Proto => 'tcp', ) || die "No connection $!\n"; print $sock "NICK $nickf\r\n"; print $sock "USER lol\r\n"; while ($input = <$sock>) { if ($input =~ /004/) { last; } elsif ($input =~ /433/) { print $sock "NICK Anderer-Nick\r\n"; } } print $sock "JOIN $channel\r\n"; print $sock "PRIVMSG $channel :\001ACTION HELLO WORLD \001\r\n";