in reply to DBI question
Please edit your post and remove the root password. Then change it on your host. (Unless you already posted a random root password in this post).
Second, your code is quite unsafe. The filename can contain anything, and you don't check
if (open my $fh, "<", $filename) { chomp (my $line = <$fh>); "$line\t" =~ m/^(?:[A-Za-z]\w*\t)+\z/ or die "Bad header in $filen +ame"; $dbh->do ("create table $tablename (". (join "," => map { "$_ varchar (20)" } split m/\t/ => $line)." +)"); }
Would be a way to do what you ask, but you didn't e.g. define what types the fields have to be.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DBI question
by gogoglou (Beadle) on Jun 23, 2010 at 11:17 UTC | |
by Tux (Canon) on Jun 23, 2010 at 13:48 UTC | |
by kennethk (Abbot) on Jun 23, 2010 at 13:59 UTC | |
by gogoglou (Beadle) on Jun 24, 2010 at 07:46 UTC | |
by Tux (Canon) on Jun 24, 2010 at 09:53 UTC |