+--------------+---------+
| stamp | state |
+--------------+---------+
| 200910021546 | Dormant |
| 200910021546 | In Use |
| 200910021352 | In Use |
| 200910021352 | Dormant |
| 200910021352 | In Use |
| 200910021125 | In Use |
| 200910021125 | In Use |
| 200910021125 | Dormant |
####
200910021546 = (Dormant,In Use)
200910021352 = (In Use, Dormant, In Use)
200910021125 = (In Use, In Use, Dormant)
####
#!/usr/bin/perl
use DBI;
#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 $recs = $sth->fetchall_arrayref({});
foreach my $r(@{$recs}){
push(@$r->{stamp}, $r->state);
}
foreach my $l(@{$r->stamp}}){
print $l, "\n";
}
$sth->finish();
$dbh->disconnect();