http://qs1969.pair.com?node_id=447988

#!/usr/bin/perl #use strict; my $user = "usern"; my $pass = "passw"; my $sql_s = "select stamp,state from pridata order by stamp limit 46"; my $dbh = DBI->connect("dbi:mysql:database=db1;",$user,$pass); my $sth = $dbh->prepare($sql_s); $sth->execute(); my $res = $sth->fetchall_arrayref(); for my $row( @$res ){ ${@$row[0]} = @$row[1]; } $sth->finish(); $dbh->disconnect();