title: Perl: Clear contents of file and open file in append mode
body: <p>I need to open a file in <em>append</em> mode in Perl, but I need that before opening file all the data is deleted and fresh data goes in.</p>
  
  <p>I will be entering data line by line, so before entering the first line I need all previous data is deleted.</p>
  
  <p>Please help.</p>