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

I would think that your proposal will work...

Replies are listed 'Best First'.
Re^4: Need help on expect
by Anonymous Monk on Feb 20, 2015 at 14:05 UTC

    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; } ],