title: Data retrieval from database using perl with a foreach
body: <pre><code>$dbh_source2 = DBI-&gt;connect("dbi:Oracle:host=.......;port=......;sid=......",'..........','..........');
  foreach $data_line (@raw_data) {
      $SEL = "SELECT arg1,arg2 FROM TABLE_NAME WHERE DATA_NAME = '$data_line'";
      $sth = $dbh_source2-&gt;prepare($SEL);
      $sth-&gt;execute();
  
      while (my @row = $sth-&gt;fetchrow_array() ) {
          print @row;
          print "\n";
      }
  }
  END {
      $dbh_source2-&gt;disconnect if defined($dbh_source2);
  }
  </code></pre>
  
  <p>I am trying to grab several lines of data from a user.  I want to take that data and use it to query a database and grab <code>ARG1</code> and <code>ARG2</code> <code>WHERE USER_DATA = $data_line</code>.</p>
  
  <p>It will not display anything.</p>