You might also look into WWW::HtmlUnit, which is perl bindings for the java library. I've been using that at work for a long time now and like it quite a bit.
Also the comments were helpfful too - can't believe there is an HTMLUnit Perl binding ... I didn't think to look for it and all this time I have been writing the Java code directly :(
]]>