in reply to Re: Re: Re: Net::Telnet variable assignment wacky
in thread Net::Telnet variable assignment wacky
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?
|
|---|