LOOP: while (<$sock>) { $line = $_; if ( $line =~ / 366 / ) { print "$line\r"; } if ( $line =~ /PRIVMSG/ ) { $line =~ /^:(.*)!(.*) PRIVMSG (.*) :(.*?)--(.*).$/; $from = $1; $room = $3; $cam = $4; if ($cam eq "") { next LOOP; } $comment = $5; if ( $cam =~ /hitty/ ) { print "<$from\@$cam> $comment\n"; } } }