Sorry guys. I was sidetrack by other issues and didn't have a chance to follow up. Here's more details of the problem:-
i) The script runs fine on my laptop. It allows me to list all instances of a praticular application program running on the system. User can then select a particular process to kill or restart. These are done using basically by calling the system command such as "ps -W", "kill -f pid".
ii) When I run the script on a remote machine inside a DOS shell through remote desktop session, I can only issue the 'list' command to list all the instances of a particular application program. The script will then freeze refusing any input from keyboard. I repeat this doesn't happen if I run the script on a local machine.
I wonder if this problem is related to the use of remote desktop. I would appreciate if someone who has experience running perl script over a remote desktop experience to shed some light on how a text mode interactive script should read the keyboard input. I suspect simply <STDIN> is not working over a remote desktop session.