#!/usr/bin/perl use strict; use warnings; use utf8; use IO::Socket::SSL; my $server = irc.REDACTED.us my $nick = 'wiseau'; my $login = 'theroom'; my $channel = 'redacted'; my $sock = new IO::Socket::SSL( PeerAddr => $server, PeerPort => 6697, Proto => 'tcp') or die "cannot connect\n"; print $sock "NICK ".$nick."\r\n"; print $sock "USER ".$login." * * :tommy wiseau\r\n"; while (my $input = <$sock>) { if ($input =~ /004/) { last; } print $input; if ($input =~ /^PING/) { my @pong1 = split(':', $input); my $pong = $pong1[1]; print $sock "PONG ".$pong."\r\n"; } } print $sock "JOIN ".$channel."\r\n"; while (chomp(my $input = <$sock>)) { print "$input\n"; if ($input =~ /^PING(.*)$/i) { print $sock "PONG ".$1."\r\n"; } if ($input =~ /hello/) { print $sock "PRIVMSG ".$channel." :Hello World"."\r\n"; } }