in reply to trying to get a loop to redo
Simple. Do something like
while ( <STDIN> ) { chomp($input = $_); if ( $input =~ /^okay\b/i ) { print "Y" } } # script continues here when STDIN is exhausted [download]