#!/usr/local/bin/perl -l use strict; use warnings; use Net::Telnet; sub t { return scalar(localtime) . " - "; } print t(), "Starting"; my $tel = new Net::Telnet(); $tel->open(Host=>'www.yahoo.com', Port=>9000, Timeout=>10, Errmode=>'return') or print t(), "Couldn't Open: ", $tel->errmsg(); print t(), "Timed Out: ", $tel->errmsg() if $tel->timed_out(); print t(), "still going strong"; __END__ laptop:~> monk.pl Tue Aug 10 23:56:32 2004 - Starting Tue Aug 10 23:56:43 2004 - Couldn't Open: problem connecting to "www.yahoo.com", port 9000: connect timed-out Tue Aug 10 23:56:43 2004 - Timed Out: problem connecting to "www.yahoo.com", port 9000: connect timed-out Tue Aug 10 23:56:43 2004 - still going strong laptop:~>