title: How to pass Perl variable into Javascript function?
body: <p>I have a Perl script which prints out of html page. I want to use javascript to pop alert msg. The alert message is defined as string in the perl variable. I am trying to pass the perl variable value to javascript function as argument but it's not working. Please help.</p>
  
  <pre><code>$perl_variable = "Welcome"; # alert msg
  
  print &lt;&lt;START
  
  &lt;HTML&gt;
  
  some html code....
  
  &lt;p&gt;Click the button to wait 3 seconds, then alert "Hello".&lt;/p&gt;
  
  &lt;button onclick="myFunction('$perl_variable')"&gt;Try it&lt;/button&gt;
  
  &lt;script&gt;
  
  function myFunction(var message){
  
  setTimeout(function(){alert(message)},3000);
  
  }
  
  &lt;/script&gt;
  
  &lt;/HTML&gt;
  
  START
  </code></pre>