#!/usr/bin/perl -w
use DBI;
srand;
my $range = 100;
my $dbh = DBI->connect("DBI:mysql:automata", 'username', 'password')
or die "Couldn't connect to database: " . DBI->errstr;
$stops = 0;
do {
my $x = int(rand($range));
my $y = int(rand($range));
my $z = int(rand($range));
my $sth = $dbh->prepare("INSERT INTO test (loc_x, loc_y, loc_z) VALUES ($x, $y, $z)")
or die "Couldn't prepare SQL statement: " . $dbh->errstr;
$sth->execute
or die "Couldn't execute SQL statement: " . $sth->errstr;
$stops++;
} until $stops > 99;
$dbh->disconnect;