in reply to Re: Need help on expect
in thread Need help on expect

Oops, I missed you've got a sequence and you expect "Enter pack name" twice. Please disregard the advice in the parent.

Replies are listed 'Best First'.
Re^3: Need help on expect
by hdb (Monsignor) on Feb 20, 2015 at 14:00 UTC

    I would think that your proposal will work...

      Possibly, but in the OP the two regexes that include "Enter pack name" are slightly different, so it's hard to tell what the intentions were (i.e. whether the two prompts are different or the same)... we'll have to wait and see what toaravind says :-)

        I used the below code as suggested and it worked like charm. Thanks all.
        my $response = "NB_CLT_7.6.0.2\r"; my $exp = Expect->spawn("./NB_update.install -s"); $exp->expect($timeout, [ qr/Enter pack name \(or q\) \[q\]:\s+/ => sub { $exp->send($response); $response = "q\r"; exp_continue; } ],