Nope, if I do the assignation without a command preceding it, the array is empty.

And the router prompt is defined (otherwise the 'cmd would time out - I'm checking the input log) and all the commands run on the router. It just doesn't assign anything to the array.

Now the guy over from me's one works fine, on the same machine. The only functional difference is that his is wrapped in a foreach loop. SO I did that to see if it would fix it, and I think maybe I've found the problem somehow. Take a look at this:

Ok, first, I've opened the telnet session, and this is the script:

my @array = ("bob","jones","dick"); foreach my $guys (@array) { print $guys; my @output= $t->cmd("sh clock"); print @output; }

Ok, now when you run it, you get this:

[me@mybox me]$ ./script bobjones11:15:49.478 GMT Tue Sep 30 2003 dick11:15:49.482 GMT Tue Sep 30 2003

See what's happening there? The first two elements of the array are being concatenated. If you shorten the number of elements in the array to just one, it doesn't run at all. Could this be related to my original problem?


In reply to Re: Re: Re: Re: Net::Telnet variable assignment wacky by Anonymous Monk
in thread Net::Telnet variable assignment wacky by bonoboy

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.