#!/usr/bin/perl -w use strict; use DBI; use Finance::QuoteHist; my $user="me"; my $password="pass"; my $database="stocks"; my @data; my $i=0; my $dbh=DBI->connect("dbi:mysql:$database",$user,$password) or die "Cannot connect to database"; $dbh->{raiserror} = 1; my $sth=$dbh->prepare("Select symbol from symbols;"); $sth->execute(); while(my @row=$sth->fetchrow_array()){ $data[$i]=$row[0]; $i++; } #Here is what I am having trouble with. my $q = new Finance::QuoteHist( symbols =>\@data, start_date => '01/01/01', end_date => 'today'); my @quotes = $q->quotes(); my $sth=$dbh->prepare("INSERT INTO stocks(symbol,date,open,high,low,close,volume,adjusted) VALUES(?,?,?,?,?,?,?,?);"); for my $i (0 .. $#quotes){ $sth->execute($quotes[$i][0],$quotes[$i][1],$quotes[$i][2],$quotes[$i][3],$quotes[$i][4],$quotes[$i][5],$quotes[$i][6],$quotes[$i][7])|| die "error: ", $dbh->errstr; } #if any one knows how to make this a little bit prettier I would also appreciate it!! $dbh->disconnect();