in reply to Problem with Net::Telnet
You can use the flexibility of a regexp to match the expected prompt without specifying the exact string. That way you can avoid the $device interpolation. It also would be better if you could anchor the prompt as the last thing read using '$'. You should turn off paging so you don't have to deal with a "more" paging prompt.
$telnet->prompt('/\w+# $/'); $telnet->waitfor($telnet->prompt); $telnet->cmd("terminal length 0"); @lines = $telnet->cmd("show run"); while (@lines) { print if /ip prefix-list/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with Net::Telnet
by SDN (Initiate) on Nov 27, 2012 at 14:57 UTC |