following loop does not produce the output IF I do not have the last exp->expect(5) line (kind of sleep). I guess this is because the loop is running 'too fast' for the 'sent' command to finish. How can i make sure the next command is run only when previous one is finished? I am collecting output in log file.
any advice, pl.
ty.
use Expect;
...
...
foreach my $cmd (@cmd_array){
$exp->expect(3,
[ qr/($|#)/ => sub { shift->send("$cmd");}]
);
exp->expect(5);
}