[lug] Telnet with here document

Ron Wright halsaves at gmail.com
Wed Apr 6 22:38:06 MDT 2005


On Apr 6, 2005 10:20 PM, Daniel Webb <lists at danielwebb.us> wrote:
> The solution I posted does what Stephen wanted.  Is there an easier way
> to do it?

Perl! (again)  I know someone already made this suggestion, but here's
some sample code from the CPAN page:

    use Net::Telnet ();
    $t = new Net::Telnet (Timeout => 10,
                          Prompt => '/bash\$ $/');
    $t->open("sparky");
    $t->login($username, $passwd);
    @lines = $t->cmd("who");
    print @lines;

Ron Wright



More information about the LUG mailing list