title: Error with opening a filehandle
body: <p>I have just begun working with Perl, I am only at the introductory level, and I have been having trouble with opening filehandles.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#!/usr/bin/perl -w
  
  $proteinfilename = 'peptide';
  
  open(PROTEINFILE, $proteinfilename) or die "Can't write to file '$proteinfilename' [$!]\n";
  
  $protein = &lt;PROTEINFILE&gt;;
  
  close PROTEINFILE;
  
  print $protein;
  
  exit;
  </code></pre>
  
  <p>Every time I tried to run the program, it gave me an error    </p>
  
  <p><code>readline() on closed filehandle PROTEINFILE at C:\BIN\protein.pl</code> </p>
  
  <p>or   </p>
  
  <pre><code>Can't write to file 'peptide' [No such file or directory]
  </code></pre>
  
  <p>Can you please help me figure this out.  I have the file <strong>peptide saved as a</strong> <code>.txt</code> and its in the same folder as the <strong>protein.pl</strong>.  What else can I do to make this work?</p>