Thanks for that Daniel, I've been able to apply the logic to the rest of the script i'm converting. There are only two bits that i don't understand in the Perl script that i need to convert, my $sql = shift; and my @row = $sth->fetchrow_array; $$StartDate = $row[0]; $$EndDate = $row[1]; $sth->finish() can you offer any advise? Mike