use IO::Socket; my $server = 'irc.openprojects.net'; my $port = 6667; my $nick = 'aziz'; my $name = 'Abdulaziz Ghuloum'; my $sock = IO::Socket::INET->new( PeerAddr => $server, PeerPort => $port) or die "Cannot connect: $!\n"; print $sock "USER $nick buf buf :$name\r\n"; print $sock "NICK $nick\r\n"; while(<$sock>){ print; my ($pingchk,$rest)=split(/ /,$_,2); if ($pingchk eq 'PING') { print $sock "PONG $rest\r\n"; } }