http://www.perlmonks.org?node_id=649071


in reply to Re^2: Interactive input via telnet
in thread Interactive input via telnet

O can use a more generic match (like: /\s\?\s*$/) and then use the $prematch var to question the user about the prompt.