Did you test it in the shell before embedding it in your perl script as suggested? If so, did it work there?
If you can pipe input at the shell prompt you can almost certainly do so in the perl script. Otherwise you'll probably have to resort to Expect or similar. Good luck.