$sql = join ' UNION ', map "SELECT ID, Name, Class, Mark, $_ table_name from $_", @tables;