in reply to Re: Dynamically passing table names to a sql query(DBI)
in thread Dynamically passing table names to a sql query(DBI)

If you're paranoid, and not certain that the table name can be interpolated directly, you also might want to consider using quote_identifier to quote the table name for the select.

Untested code...

my $quoted_table = $dbh->quote_identifier($table); my $sth = $dbh->prepare(qq{SELECT * FROM $quoted_table}) or die "Can't prepare statement: $DBI::errstr";