#!/usr/bin/perl -w
######################################################################
# telnet.pl
######################################################################
# Perl Power! - Michael Schilli 1998
######################################################################

use Net::Telnet;

$host   = "localhost";                       # computer
$userid = "mschilli";                        # ID
$passwd = "secret!";                         # password
$prompt = quotemeta('$');                    # prompt

$telnet = Net::Telnet->new(Host    => $host,
                           Timeout => 60,    # 60 seconds
                           Prompt  => "/^$prompt/m");

$telnet->login($userid, $passwd);            # login

@lines = $telnet->cmd("/bin/ls -l");         # issue command
print "@lines\n";                            # output result

@lines = $telnet->cmd("uptime");             # issue command
print "@lines\n";                            # output result

