title: how to use onclick with href on cgi perl
body: <p>I do have a list of files on page and next each file there is a link says delete, simply user by clicking the delete link it passes the file name on to the function  on the same script then it deletes the file from server and it says on the same page, any idea?</p>
  
  <pre><code>#some other stuff goes here such list of files 
  print "&lt;TD&gt;&lt;a onclick='deleteFile()' href='#'&gt;delete&lt;/a&gt; &lt;/td&gt;";
  
  sub deleteFile()
  { 
      unlink ($file);
  }
  </code></pre>
  
  <p>I also tried pure cgi perl and when I click delete link it prints error "Internal Error" but when I look for the file to see if it has been delete or not then the file actually deleted so there is no permission issue here else it wouldn't delete or unlink the file, here is what changed to:</p>
  
  <pre><code>print "&lt;a href='../cgi-bin/deleteFile.cgi?param1=$dir&amp;param2=$file'&gt;delete&lt;/a&gt;";
  </code></pre>
  
  <p>here what I have in deleteFile.cgi I get both param1 &amp; 2 and use unlike like below</p>
  
  <pre><code>unlink($location);
  </code></pre>