in reply to Need help to correct a simple script
The SQL needs to be declared in the loop, as you're changing the variable $count each time.
Consider the more idiomatic
foreach my $count (1..$tables) { my $sql =<<EOF; .... EOF die ("Failed to insert row: " . DBI->errstr) if (!($dbh->do ($sql) +)); }
Unfortunately you can't prepare and execute this statement with bound variables, as the table name is formed from one of the variables.
A Monk aims to give answers to those who have none, and to learn from those who know more.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Need help to correct a simple script
by terrykhatri531 (Novice) on Jan 07, 2013 at 18:36 UTC |
In Section
Seekers of Perl Wisdom