in reply to From database to hash table
#!/usr/bin/perl use warnings; use strict; use DBI; use Data::Dumper; my $db = DBI->connect("dbi:$driver:", q(), q()); my %hash; my $sth = $db->prepare('select week, month, workperiod from tablename' +); $sth->execute; while (my ($week, $month, $workperiod) = $sth->fetchrow_array) { $hash{$week} = [$month, $workperiod]; } print Dumper \%hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: From database to hash table
by Tux (Canon) on Sep 06, 2012 at 17:26 UTC |