Hello,
Im not sure if this is what your looking for, but you may be looking for something similar to expect. expect allows you to feed input based on the ouput of another comsole program. So you could output a 1 to the screen after you see the string "Please Enter your selection";
use Expect;
$lis = Expect -> spawn ("/bin/yourprog");
$lis -> expect (30, "Please Enter your selection:");
print $lis "1\r";
hope this helps