Thread Kleine Tabelle in einen Hash einlesen (2 answers)
Opened by Florian at 2012-04-04 21:52

pq
 2012-04-04 23:40
#157253 #157253
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
was kannst du denn schon?

ungetestet:
Code (perl): (dl )
1
2
3
4
5
6
7
8
my $sth = $dbh->prepare("SELECT MODULENAME, de, en, fr FROM t");
$sth->execute;
my $modules;
while (my $row = $sth->fetchrow_hashref) {
    for my $lang (qw/ de en fr /) {
        $modules->{ $row->{MODULENAME} }->{ $lang } = $row->{ $lang };
    }
}
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Kleine Tabelle in einen Hash einlesen