I have a script that sets up a telnet session as an object, where I want to then write to that session,(object) but I can not manage to write to the object ie...the telnet session sets up fine but when I want to write in the username/pswd, the deatils I send are not being received....any ideas... code below thanks splat
#!/usr/bin/perl -w use Expect; my $command = new Expect; #print $command "telnet stiletto23-cssp0\r"; $command = Expect->spawn("telnet stiletto23-cssp0") or die "Couldn't s +tart program: $!\n"; sleep 1; #prevent output from being shown on our STDOUT $command->log_stdout(1); #wait 10 seconds for "username:" to appear unless ($command->expect(10, "username:")) { #print "timed out"; } # send "username" and a carriage return to the program print $command "admin\r"; sleep 1; print $command "netra1\r"; print "now here\n";

In reply to writing to an object (telnet session) using expect by splatohara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.