i'm not familiar with perl ... but i guess that you pass the js-variable-value with a query-string for example (that you may set with javscript dynamically), so have a look at the pseudocode below:
Alternatively, you can set the value of a hidden form element to the variable value. Submit the form and you'll receive this variable value as a form value in your Perl script. If the method is GET instead of POST, it'll be similar to gits' suggestion (in the URL).
Comment