title: Can someone explain this Perl code snippet?
body: <p>This little piece of code has been a staple in a bunch of my scripts, but I took the syntax from another working script that someone else wrote and adapted it to fit my needs.  I'm not even sure that the syntax used here is the best or most common way to open a file handler either.</p>
  
  <p>The code is:</p>
  
  <pre><code>$fh = \*STAT_FILE;
  open ($fh,"&gt;&gt;".$stat_file) or die "Can't open $stat_file: $!\n";
  my $print_flag = ( -z $stat_file );
  </code></pre>
  
  <p>I don't fully understand the first line and also the last line of the code above.  Specifically, <code>\*STAT_FILE</code> and <code>-z</code>, respectively.</p>
  
  <p>I know that, for the most part, the second line will open a file for appending or quit and throw an error.  But again, I don't understand what purpose the <code>$!</code> serves in that line either.</p>
  
  <p>Can someone explain this Perl code, line-by-line, to me in pseudo?  Also, if the method above is not the preferred method, then what is?</p>
  
  <p>Thanks in advance</p>