There was a bug in the code that was posted as a reply. I don't think Xilman intended that code to be blindly copy-and-pasted, but here's what's probably going on:
# This should not have the '$dbh->' at the beginning, but the real iss +ue is # $cluster here is a scalar, but foreach my $cluster (@clusters) { # here, they are being treated as arrays (if they were interpolated as + written. # $dbh->do ("INSERT INTO $table (start, end) VALUES (cluster[0], clust +er[1]);"); # a better approach, if your DBI module supports placeholders: $dbh->do ("INSERT INTO $table (start, end) VALUES (?,?);", @{$cluster} +) # or even: $dbh->do ("INSERT INTO $table (start, end) VALUES (?,?);", +$cluster->[0], $cluster->[1]) }
Again, this is untested code, and may not work as advertised. If the -> and @{} are confusing you, check out perlreftut for more info on references.
@_=qw; Just another Perl hacker,; ;$_=q=print "@_"= and eval;
In reply to Re^3: perl and psql
by bv
in thread perl and psql
by gogoglou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |