I am writing a simple IRC client that connects to a handful of servers and waits for input. Current I can correctly join and listen to one server, but I am unsure of how to add multiple servers to the mix. If someone could point me in the right direction I'd appreciate the assistance. I've been messing around with IO::Select but I'm not sure if that's the correct approach or not.
my $sock = new IO::Socket::SSL(PeerAddr => 'myircserver', PeerPort => +'6697', Proto => 'tcp') or die "Can't connect\n"; print $sock "NICK mlapaglia\r\n"; print $sock "USER mlapaglia\r\n"; while(my $input = <$sock>) { if($input =~ /004/) { last; } elsif($input =~ /433/) { die "nickname already in use\n"; } } print $sock "JOIN #testing123\r\n"; while(my $input = <$sock>) { chop $input; if($input =~ /^PING(.*)$/i) { print $sock "PONG $1\r\n"; } elsif($input =~ /^:(.*)!(.*)\@(.*?) PRIVMSG (.*)/i) { event_privmsg("myserver", $4, $1, $3); } }

In reply to Perl Simple IRC Client question by mlapaglia

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.