In a similar situation, we found that the best way was to use ->waitfor(match), using a regex that matched whichever prompt came up first, and then do a conditional based on the match result, rather than using ->login. Net::Telnet's login isn't really designed to cope with this situation, but you can do almost anything with a clever use of waitfor.