If your app uses windows routines, look at Win32::GuiTest, which allows you to get window focus, push buttons, make entries in text boxes etc. (with copious use of "sleep(1)" for pauses etc). It has a SendKeys method which has worked well for me in a lot of places. It's in CPAN, but the latest, more extensive (more experimental) version (1.50, last I checked) is available from Files option if you join the guitest group. Doco is limited, but the group records hold explanations for many things, and examples.
Comment on Re: Pass expected input to Windows program