in reply to Help using Expect.pm

Did some troubleshooting and the problem seems to be when looking for the string "$", it is not there in the response, but the module log file says it is -
spawn id(6): Does ` '^M
match:^M
pattern #1: -re `$'? YES!!^M
Before match string: ` '^M
Match string: `'^M
After match string: `'^M
Matchlist: ()^M
Dec 03 18:09:57 Increasing my step to 5
Dec 03 18:09:57 Value of step is 5

Replies are listed 'Best First'.
(bbfu) Re2: Help using Expect.pm
by bbfu (Curate) on Dec 04, 2002 at 01:27 UTC

    I'm pretty certain that the parameter to expect() is a regexp, which means that $ would be the end-of-line marker, instead of a literal $. Try escaping it with a backslash.

    As an aside, it would help if you could include more of the surrounding code. Specifically where you set up the session, and the data that you're actually sending to the send() and expect() calls. It would be best if you reduced it to a "least-common-denominator" snippet that could be run and exhibits the problem.

    bbfu
    Black flowers blossum
    Fearless on my breath

      Thank-you...that was the problem. I had to escape the "$" character because it was interpreting it as the end-of-line marker in lieu of the literal $.