title: readline() on closed filehandle
body: <p>Running this code produces an error stating "readline() on closed filehandle SEQFILE at line 14." Previous searches have all commented on how one should put some type of conditional after open. Doing so just kills the program (i left it out so I could see why it didn't open). I would guess the deeper problem is why is it not opening my file?</p>
  
  <pre><code>#!/usr/bin/perl -w
  
  #Ask user to point to file location and collect from the keyboard
  print "Please specify the file location: \n";
  $seq = &lt;STDIN&gt;;
  
  #Remove the newline from the filename
  chomp $seq;
  
  #open the file or exit
  open (SEQFILE, $seq);
  
  #read the dna sequence from the file and store it into the array variable @seq1
  @seq1 = &lt;SEQFILE&gt;;
  
  #Close the file
  close SEQFILE;
  
  #Put the sequence into a single string as it is easier to search for the motif
  $seq1 = join( '', @seq1);
  
  #Remove whitespace
  $seq1 =~s/\s//g;
  
  #Use regex to say "Find 3 nucelotides and match at least 6 times
  my $regex = qr/( ([ACGT]{3}) \2{6,} )/x;
  $seq1 =~ $regex;
  printf "MATCHED %s exactly %d times\n", $2, length($1)/3;
  exit;
  </code></pre>