in reply to Run onclick action on website.

If the button runs an AJAX script to form the page then you must find a way to send what it does and to then do what it does with what it receives. Maybe a better solution to your problem is to use Selenium, a non-Perl tool which actually drives an actual browser. Instead of trying to simulate what a browser does ... drive a browser directly.