$telnet->print("/opt/bea/tuxedo8.1/bin/tmloadcfGPPconfig.ubb"); my ($prematch,$match) = $telnet->waitfor( -match => $telnet->prompt, # to wait for the regular prompt -match => qr{\[y,\s*q\]}, # wait for the [y, q] prompt ); $telnet->cmd("y") if ($match =~ qr{\[y,\s*q\]} );