Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Need help on expect

by Anonymous Monk
on Feb 20, 2015 at 13:00 UTC ( [id://1117325]=note: print w/replies, xml ) Need Help??


in reply to Need help on expect

If I am understanding your requirement correctly then a quick fix might be this:

# at the top of your script: my $state = 0; # ... [ qr/Enter pack name \(or q\) \[q\]:\s+/ => sub { if ($state==0) { $exp->send("NB_CLT_7.6.0.2\r"); } else { $exp->send("q\r"); } $state++; exp_continue; } ],

(untested)

Replies are listed 'Best First'.
Re^2: Need help on expect
by Anonymous Monk on Feb 20, 2015 at 13:02 UTC

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

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1117325]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-23 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found