At the risk of having a thousand flame throwers turned on me,
you could also look at a language called expect. It was
written with 'pretending to be a human at the keyboard' in mind.
For short little tasks like this, it does pretty well.
<pedant>Actually Expect isn't a language at all, but an extension to Tcl (so best not go there!) But there's an Expect.pm on the CPAN which allows you to do all the same things from Perl.</pedant>