in reply to Expect question

OK, I solved the problem. Cannot say I understand why it is the way it is, but it works...

I was about to try the few lines proposed by Argel when I noticed that example was using single quotes '...'rather than doubles like I was using "..." Before trying those lines I just replaced my doubles with single quotes and changed nothing else. it worked just fine. I even killed the spaces trailing the colon after password and it still matched just fine.

The string I was trying to match was the "Password:" part of the entire return from the server, which looked like "Connecting to <ip>... \n\rPassword: ". I know using 'Password:' works but I have no idea why. (just went back and read some more about single and double quotes, but I'm still in the fog)

Since this is a slightly different problem, I just wanted to post here my findings and thank you for your replies. I'll ask the next question in a separate thread.

Replies are listed 'Best First'.
Re^2: Expect question
by Argel (Prior) on Oct 29, 2007 at 19:54 UTC
    I noticed that even in some of my 7 year old code I was normally using single quotes but there are one or two places where I used double quotes. I wonder what platform and what perl you are using? We had a Red Hat 3 (?) system here with perl 5.8.0 on it that had some really odd behavior.

    As a side note, I suspect I was normally using single quotes because that's good practice if the string does not contain anything that needs to be interpolated. Though I suppose actually making them constants would be even better practice but I hate 'use constant'. What I really want is a constant that I can treat like a variable, so if ReadOnly was ever made Core I would likely use that.

    Anyway, thanks for passing the solution on as I'm sure others can benefit and it's always great to hear how things turned out when someone asks a question. Err, well, except for paco, where the mystery is surely better than the answer (unless he has a great hot dog recipe).

      I was running Perl 5.8.8 on a Suse 10.2 machine. ... About that hot dog recipe, if you or anybody else get your hands on it, please post :)
        Even if the secret ingredient is dog hair?! ;-)