use Net::Telnet; if ( my $t=new Net::Telnet(Port => 80, Host => "localhost", Timeout => 5 )->open() ) { print "localhost is active"; $t->close(); };