Steve4950 has asked for the wisdom of the Perl Monks concerning the following question:

I'm not having any luck matching up this prompt, any help??

0x00350: 72 20 70 72 65 73 73 20 46 49 4e 49 53 48 3a 20 r press FINISH:
0x00360: 1b 5b 32 31 3b 36 34 48 1b 5b 37 6d 20 1b 5b 32 .[21;64H.[7m .[2
0x00370: 31 3b 36 34 48 20 20 20 20 20 20 20 20 20 20 1b 1;64H .
0x00380: 5b 32 31 3b 36 34 48 [21;64H

$telnet->prompt('/\.\[21;64H\.\[7m\s\.\[21;64H\s\s\s\s\s\s\s\s\s\s\.\[21;64H $/');

Thanks....

Replies are listed 'Best First'.
Re: Prompt help with Net::Telnet
by trantor (Chaplain) on Aug 13, 2001 at 19:45 UTC

    The dots you see on the right, in the ASCII representation, are not literal dots. A dot in that context stands for a general unprintable character. This is an ancient convention still in use today...

    If you see on the left the corresponding ASCII code, it is hexadecimal 1B, which is ESC (Escape). This means it should be \e and not \. in your regular expression.

    Then, if you want to match the prompt exactly as it is, spaces should be matched with an actual space, not with \s which also matches tabs for example.

    Finally, if things get tough, you may want to have a look at Expect on CPAN.

    Happy matching!

    -- TMTOWTDI