title: Perl: How to print next line after matching a pattern?
body: <p>I would like to print specific data after matching a pattern or line. I have a file like this:  </p>
  
  <pre><code>#******************************    
  List : car  
  Design: S  
  Date: Sun 10:10  
  #******************************
  
  b-black  
  g-green
  r-red  
  
  Car Type              No.           color  
  #-------------------------------------------    
  N17              bg099            g  
  #-------------------------------------------    
  Total 1 car  
  
  #****************************** 
  List : car  
  Design: L  
  Date: Sun 10:20  
  #******************************
  
  b-black  
  g-green
  r-red  
  
  Car Type            No.            color   
  #-------------------------------------------    
  A57            ft2233            b  
  #-------------------------------------------    
  Total 1 car  
  
  #******************************    
  List : car  
  Design: M  
  Date: Sun 12:10  
  #******************************    
  
  b-black  
  g-green
  r-red  
  
  Car Type           No.             color  
  #-------------------------------------------    
  L45            nh669             g   
  #-------------------------------------------    
  Total 1 car  
  
  #. .    
  #. .     
  #.    
  #.    
  </code></pre>
  
  <p>I want to print the data for example after the lines "Type...." and dashes line"------" which is N17 and bg099. I have tried this but it cannot work.  </p>
  
  <pre><code>my @array;    
  
  While (@array = &lt;FILE&gt;) {    
  
  foreach my $line (@array) {    
  
  if ($line =~ m/(Car)((.*))/) {      
  
  my $a = $array[$i+2];    
  push (@array, $a);    
  }  
  
  if ($array[$i+2] =~ m/(.*)\s+(.*)\s+(.*)/) {    
  my $car_type = "$1";      
  print "$car_type\n";      
  }      
  }    
  }    
  </code></pre>
  
  <p>Expected Output:  </p>
  
  <pre><code>Car Type            No.  
     N17             bg099  
     A57             ft2233    
     L45             nh669  
     ..              ..  
     .               . 
  </code></pre>