The Synopsis section of the Expect docs seems fairly straight-forward. While I haven't tested the code below, I believe it should work as intended.
my $exp = new Expect; $exp->raw_pty(1); $exp->spawn( $command, @params ) or die $!; $exp->expect( $timeout, [ qr/replace\s+\S+?\s+\[y\]es,\s+\[n\]o,\s+\[A\]ll,\s+\[N\]one,\s+ +\[r\]ename:/i => sub{ my $exp = shift; $exp->send( "A\n" ); exp_continue; } ], ); $exp->soft_close();
Hope that helps.
In reply to Re: Need help on perl Expect Module
by atcroft
in thread Need help on perl Expect Module
by sriram83.life
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |