As rafl said in his comment, Perl does not have DOM events. You'd have to go through JavaScript in order to respond to this event without changing the page.
Here's how it goes: Perl creates text that gets interpreted by your browser according to the standards as they identify themselves. Since, your browser expects the base context to be an SGML/HTML document it interprets the SGML/HTML tags as document information and layout instructions. When it comes to a <script>
tag, if the script identifies itself as JavaScript (or does not specify the language), the browser interprets text inside that tag as JavaScript and performs the actions specified.
Perl creates the text, only client-side script runs on your browser, completely independent from the Perl that created the text. You can communicate back to the server through forms and cookies (actually part of the HTTP protocol--the actual base context of the communication), but there has to be another request to the server. The only thing that can tell a browser what to do in response to interaction with the browser is client-side code executed by the browser.
In order to create a web application Perl (or any other server-side language) just has to create text that uses the browser capabilities to send data back to the server, so that the server-side process can read the state and generated new text that replicates the interaction.
The current way of doing this dynamically, without changing the page is through Ajax, which is basically offers the JavaScript an object to make server requests. (The idea is not totally new, we used to accomplish similar things in Java Applets, it's just that Ajax cuts out a middle man.) A good toolkit for JavaScript/Ajax is the prototype library.