Probably the most common way to handle user input these days is to use some kind of client-side JavaScript library (take your pick), and AJAX. For whatever driver you are likely to use, there are ready-made Perl interfaces for the server side.
"The program that the user deals with" is a Javascript program, not Perl.