title: Including separate javascript file in perl script
body: <p>I have set of perl CGI webpages that I am attempting to do some refactoring on but have run into a wall. </p>
  
  <p>Each of these scripts has some javascript and CSS currently written in the form:</p>
  
  <pre><code>my $JSCRIPT = &lt;&lt; CODE;
  function doStuff() {
    // Stuff
  }
  CODE;
  
  my $CSS = &lt;&lt;BLOCK;
  .css-stuff{}
  BLOCK
  </code></pre>
  
  <p>The javascript and CSS is later loaded to the page using CGI</p>
  
  <pre><code>print $cgi-&gt;start_html( -script =&gt; [{-type =&gt; "javascript", -code =&gt; $JSCRIPT}],
                          -style =&gt; {-code =&gt; $CSS} );
  </code></pre>
  
  <p>Is there a good way to refactor this code so that instead of having copies of that $JSCRIPT in multiple files, I can have a single <code>common.js</code> or similar file? How do I include a file to accomplish this?</p>