title: Perl File Reading and RegEx Matching
body: <p>I'm doing a little perl script, but i've some problem while reading file, and than iterate over regex.</p>
  
  <p>In particulary the file is over multiple line, and for each line, i need to extract some value, i post an example to understand better.</p>
  
  <p>This is sample line of file</p>
  
  <pre><code>            1A    OCC OCC  4B  5B  6B  7B  8B    9A
        OCC OCC    12B 13B 14B OCC 16B 17B 18B   OCC OCC
  </code></pre>
  
  <p>i need to match for the first, second, n..,  line separetly:
  1A
  4B
  5B
  6B
  7B
  ...</p>
  
  <p>excecpt OCC.</p>
  
  <p>i wrote this code:</p>
  
  <pre><code>my $path="file.txt";
  
  open (my $fh, "&lt;", $path);
  
   while(my $line = &lt;$fh&gt;)
   {
      for ($line =~/(\d{1,2}[A|B|C])/){   
        print " $1";  
   }
  }
  </code></pre>
  
  <p>The result that i obtained is only match for the first occurance matched on the line.
  1A 12B </p>
  
  <p>How can i extend  for read all line and match the content correctly?</p>
  
  <p>The print result is only for my debugging test.</p>