title: Perl: using grep to extract a pattern matching substr of a file line
body: <p>i have the following content in a file:</p>
  
  <p>gi|<strong><em>170570902</em></strong>|gb|ABLA01000008.1|  0.457  24  0.581  24  0.876  11  0.744   0.669 Y  0.450      SignalP-noTM</p>
  
  <p>For every line in the file I would like to extract the number highlighted above and push it to an array. I'm trying to grep this number and extract it from the matched line, but I don't seem to find the right way to do it.</p>
  
  <p>Here's what I have in mind:</p>
  
  <pre><code>while ($sec_gi = &lt;IN_SIDS&gt;){
      $sec_gi =~ s/[0-9]{5,}/$&amp;/;
      print $sec_gi."\n";
  }
  </code></pre>
  
  <p>$&amp; is supposed to be the exact match string. With this I get the matched line EXCEPT the match pattern, which is exactly the opposite to what I want. </p>
  
  <p>Could anyone pls help?</p>
  
  <p>Thanks!</p>