$telnet->prompt('/\w+# $/'); $telnet->waitfor($telnet->prompt); $telnet->cmd("terminal length 0"); @lines = $telnet->cmd("show run"); while (@lines) { print if /ip prefix-list/; }