Also you could do this:-
use IO::Socket;
use warnings;
use strict;
$sock = IO::Socket::INET->new(
PeerAddr => 'server_here',
PeerPort => 6667,
Proto => 'tcp' ) or die "could not make the connection";
while($line = <$sock>){
print $line;
if($line =~ /(NOTICE AUTH).*(checking ident)/i){
print $sock "NICK nick_here\nHelpBot :just a bot\n";
last;
}
}
while($line = <$sock>){
print $line;
if($line =~ /^PING/){
print $sock "PONG :" . (split(/ :/, $line))[1];
}
if($line =~ /(376|422)/i){
print $sock "NICKSERV :identify nick_password\n";
last;
}
}