for (@table_names) { my ($mark) = $dbh->selectrow_array("select Mark from $_ where id = $id"); }