$exp->expect($timeout,
[ qr/regex1/ => sub {
my $exp = shift;
...
$exp->send("response\n");
} ],
[ qr/regex2/ => sub {
my $exp = shift;
...
$exp->send("response\n");
} ],
);
$exp->expect($timeout,
[ qr/regex1/ => sub {
my $exp = shift;
...
$exp->send("response\n");
exp_continue
} ],
);
Alternatively,
$first = 1;
$exp->expect($timeout,
[ qr/regex1/ => sub {
$first = 0;
my $exp = shift;
...
$exp->send("response\n");
} ],
[ qr/regex2/ => sub {
return exp_continue_timeout unless $first;
$first = 0;
my $exp = shift;
...
$exp->send("response\n");
} ],
);
Update: Part of my reply got accidently erased. Re-added the missing chunk. |