#!/usr/bin/perl
# работа с БД из Perl'а
# delete, select
use DBI;

# connecting to DBMS
$dbh=DBI->connect("DBI:mysql:DB","USER","PASSWD") || die DBI::errstr;

# отчистка временных баз
$dbh->do("delete from Country");

$sth=$dbh->prepare("select Date,Site,URI,IP,IP_X,Refer,User_Agent,Pragma,Country from Req order by ID");
$sth->execute;
while(($Date,$Site,$URI,$IP,$IP_X,$Refer,$User_Agent,$Pragma,$Country)=$sth->fetchrow_array){
    # работа с данными
}
$sth->finish;

$dbh->disconnect;
