#!/usr/bin/perl use strict; use IO::Socket::INET; my $c = IO::Socket::INET->new("bofh.jive.org:666") or die "connect: $@"; while (<$c>) { next unless /Your excuse is: (.*)/; print ucfirst $1, "\n"; exit; }