title: In Perl, how can I get the matched substring from a regex?
body: <p>My program read other programs source code and colect information about used SQL queries. I have problem with getting substring.</p>
  
  <pre><code>...
  $line = &lt;FILE_IN&gt;;
  until( ($line =~m/$values_string/i &amp;&amp; $line !~m/$rem_string/i) || eof )
  {
     if($line =~m/ \S{2}DT\S{3}/i)
     {
  
     # here I wish to get (only) substring that match to pattern \S{2}DT\S{3} 
     # (7 letter table name) and display it.
        $line =~/\S{2}DT\S{3}/i;
        print $line."\n";
  ...
  </code></pre>
  
  <p>In result print prints whole line and not a substring I expect. I tried different approach, but I use Perl seldom and probably make basic concept error. ( position of tablename in line is not fixed. Another problem is multiple occurrence i.e.[... SELECT * FROM AADTTAB, BBDTTAB, ...] ). How can I obtain that substring?</p>