I have put together a script using the Perl Expect module to log into multiple hosts 
and execute a list of commands. I would like to be able to capture the output from 
each host and pattern match against it. The script (login and and issue commands) 
works fine, but I need some help on the capturing output piece. Is there a way to 
redirect from the standard out, within the script, into an array or something for 
parsing?

Also, if anyone knows of any good Perl Expect tutorials or demo pages, that would a 
big help.

Thanks,
Jose


I assume it would probably happen at the point I issue my commands:

#### snippet ####
open COMMAND_FILE, "<$command_file" or die "Cannot open $command_file!\n";
while (<COMMAND_FILE>) {
chomp;
my $command = $_;
   $exp->send("$command\r");
   $exp->expect($timeout, "$command\r\n");
}
#### snippet ####

Reply via email to