shawshankred has asked for the wisdom of the Perl Monks concerning the following question:
my %tab2hash = qw(divisions divH regions regH); sub initHashesArraysFromDB { my ($k1, $v1); while ((my $KEY_1, my $VALUE_1) = each %tab2hash) { my $sth = $dbh->prepare("select * from $KEY_1"); $sth->execute || die "Cannot execute query: " .DBI->errstr; while (my @row = $sth->fetchrow()) { my $f1 = 0; foreach my $col (@row) { if($f1 == 0) { $f1 = 1; $k1 = $col; $v1 = $col; } else { $v1 .= "|" . $col; } } $$VALUE_1{$k1} = $v1; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Varibale for HAsh name
by Corion (Patriarch) on Oct 22, 2010 at 16:36 UTC | |
|
Re: Using Varibale for HAsh name
by SuicideJunkie (Vicar) on Oct 22, 2010 at 16:38 UTC | |
|