#!/usr/bin/perl5.14.1 use DBI; use Data::Dumper; my @data; my $dbh = DBI->connect("DBI:host", 'name', 'pw', { RaiseError => 1, AutoCommit => 1 }, ); my @tesxt = ('perl','python','pearl', 'pear', 'pink', 'pong'); my @array1 = ('fan','friend','fang', 'fun', 'food', 'flow'); my @array2 = (21,22,23,14, 15, 16); my @array3 = ('oh','orange','okay','ostrich', 'open', 'osaka'); my @jumpjump= ($tesxt[0], $tesxt[2], $tesxt[3], 'kit','kat',7); push (@data, \@tesxt); push (@data, \@jumpjump); push (@data, \@array1); push (@data, \@array2); push (@data, \@array3); splice (@jumpjump); @jumpjump= ($tesxt[0], $tesxt[2], $tesxt[3], 'koo','kaa',7); push (@data, \@jumpjump); print Dumper \@data; my $sth = $dbh->prepare("insert into table_test (just, random, field, +for +, testing, purposes) values (?, ?, ?, ?, ?, ?)"); $dbh->begin_work(); foreach my $row (@data) { $sth->execute(@$row); } $dbh->commit(); $dbh->disconnect;
In reply to Re^2: Push array into array of arrays
by Anonymous Monk
in thread Push array into array of arrays
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |