in reply to Looking for a faster method

This is really confusing:
foreach (%channels) { $sock->send("JOIN $_\n") if ($channels{$_}); }
also, $userHost could be probably gained as a result of one match, i.e. !(.*)@(.*) => !([^\s]+)