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

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 :-)

Replies are listed 'Best First'.
Re^5: Need help on expect
by toaravind (Initiate) on Feb 25, 2015 at 08:48 UTC
    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; } ],