title: Extract blocks of text from a file and write each block to a new file using perl, but it is not working
body: <p>I have a large data file (text) that contains records from a database.
  Each record is is delimited by "-" (146 of them) 
  I would like to write the text between each delimiter to a new file based on data from that block.  The new file name should contain a piece of the data followed be the year (ie 2017)</p>
  
  <p>For instance with this sample file:   </p>
  
  <pre><code>1. 12/18/17                                                       
  Company                                      
                       PAGE 2
      1:14 PM  GET                                              CURRENTLY SELECTED DEBTORS
  
  ------------------------------------------------------------------------------------------------------------------------
  ----------------------------- STATUS              **Acct:1234**       Disposition:9000 CANCEL                      Wait: 04/11/17
  
  DEBTOR              Name:Doe John                         
  Ssn:123456789   Cbr:  Ph:555-555-555
                        Rp:Doe John                           Ssn:               Rp Ph: 
                      Adr1:211 some road     POE:                      Lgl:   POE Ph: 
                      City:anytown                Cty:                     Canc:UNC  Born:01/01/1937
                        St: VA  Zip:54321        St:     Zip:             COF:N     Sal:
  
                      Clnt:00248 Someplace, 93076                         Org:    4
  80.00
                      List:01/05/17 Srv:08/25/16 Pl95:    Time:9    Calls:0   Con:0   Bal:    480.00
  
  Co-Maker's Previous Address Spouse's Previous Address MULTIPLE
  ACCOUNTS RM# Acct      Name / Client     Chk# / Lst   Srv      Lpy  
  Col Disp        Bal      Check Reason          Drivers Licen se #
        PRN      INT      LI3      LI4     AIN      CC     ATY      MS1     PJI 1   142424*   Doe John                                  
  93076/00248/Somewhere  01/05/17 08/25/16            0 9000    
  480.00
     480.00     0.00     0.00     0.00    0.00    0.00    0.00     0.00    0.00
  
  2. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  </code></pre>
  
  <p>So from the above is need to extract this block and write it to a new file named 1234_2017.txt based on the Acct:1234 data for that record- then move to the next block.  I have counted the number of records for the first file at 754 records, and I have a total of 10 files such as this.</p>
  
  <pre><code>#! / usr/bin/perl -w
  
  use strict;
  use warnings;
  
  use POSIX 'strftime';
  
  my $filename = "Facs_Data.txt";
  my $outfile = "Acct_".strftime '%Y', localtime;
  my $start = "'-' x 146";
  
  open (INFILE, "&lt;$filename"); open (OUTFILE, "&gt;$outfile");
  
  while ($start) {
  
    print $outfile;
    next
  }
  close (INFILE);
  close (OUTFILE);
  </code></pre>
  
  <p>Any suggestions will be greatly appreciated.</p>