title: Using Perl to extract text from a text file
body: <p>I have a question related to using regex to pull out data from a text file.  I have a text file in the following format:</p>
  
  <pre><code>REPORTING-OWNER:    
  
      OWNER DATA: 
          COMPANY CONFORMED NAME:         DOE JOHN
          CENTRAL INDEX KEY:          99999999999
  
      FILING VALUES:
          FORM TYPE:      4
          SEC ACT:        1934 Act
          SEC FILE NUMBER:    811-00248
          FILM NUMBER:        11530052
  
      MAIL ADDRESS:   
          STREET 1:       7 ST PAUL STREET
          STREET 2:       STE 1140
          CITY:           BALTIMORE
          STATE:          MD
          ZIP:            21202
  
  ISSUER:     
  
      COMPANY DATA:   
          COMPANY CONFORMED NAME:         ACME INC
          CENTRAL INDEX KEY:          0000002230
          IRS NUMBER:             134912740
          STATE OF INCORPORATION:         MD
          FISCAL YEAR END:            1231
  
      BUSINESS ADDRESS:   
          STREET 1:       SEVEN ST PAUL ST STE 1140
          CITY:           BALTIMORE
          STATE:          MD
          ZIP:            21202
          BUSINESS PHONE:     4107525900
  
      MAIL ADDRESS:   
          STREET 1:       7 ST PAUL STREET SUITE 1140
          CITY:           BALTIMORE
          STATE:          MD
          ZIP:            21202
  </code></pre>
  
  <p>I want to save the owner's name (John Doe) and identifier (99999999999) and the company's name (ACME Inc) and identfier (0000002230) as separate variables.  However, as you can see, the variable names (CENTRAL INDEX KEY and COMPANY CONFORMED NAME) are exactly the same for both pieces of information.</p>
  
  <p>I've used the following code to extract the owner's information, but I can't figure out how to extract the data for the company. (Note: I read the entire text file into $data).</p>
  
  <pre><code>if($data=~m/^\s*CENTRAL\s*INDEX\s*KEY:\s*(\d*)/m){$cik=$1;}
  if($data=~m/^\s*COMPANY\s*CONFORMED\s*NAME:\s*(.*$)/m){$name=$1;}
  </code></pre>
  
  <p>Any idea as to how I can extract the information for both the owner and the company?</p>
  
  <p>Thanks!</p>