in reply to How to give input to a program which is inside perl script

Perhaps something like :
system "echo 1 | getapdata";
In case you need the output from getpdata, use backticks or the "qx" function.

There are other, more complex options, including "open2".

    Earth first! (We'll rob the other planets later)