in reply to Failure plugging table into into query

As stated above, you need to use double quotes for that to work correctly.

However, you are treding on dangerous security ground here. If someone can modify that text file, they might be able to execute any SQL statement they want:

SELECT Names FROM ; DROP some_table ;WHERE Name = ?

Many databases won't let you use a placeholder on the table name (I often wish they did). The best you might be able to hope for is this:

my $safe_table = $db->quote($table); $sth = $db->prepare("SELECT Names FROM $safe_table WHERE Name = ?");