http://www.perlmonks.org?node_id=626956


in reply to Variable is filled with column name not data, can't figure out why.

Straight from the DBI Docs:
With most drivers, placeholders can't be used for any element of a statement that would prevent the database server from validating the statement and creating a query execution plan for it. For example: "SELECT name, age FROM ?" # wrong (will probably fail) "SELECT name, ? FROM people" # wrong (but may not 'fail')

So you'll need to change your code to:

$sth = $dbh->prepare(qq~select $rating from FanRatings where Title = ? +~) or die $DBI::errstr; $sth->execute($filename) or die $DBI::errstr;