Thread for-Schleife: Laufvariable als Referenz (10 answers)
Opened by bloonix at 2006-07-17 15:10

bloonix
 2006-07-17 16:10
#68128 #68128
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
statt

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
while (my $row = $sth->fetchrow_hashref) {
for my $db (@{$where{NEW_DB}}) {
$row->{Db} = $db;
for my $user (@{$where{NEW_USER}}) {
$row->{User} = $user;
print "INSERT INTO DB ";
print join(",", map { "$_:'$row->{$_}'" } keys %{$row});
print ";\n";
}
}
}


hätte ich gerne das geschrieben

Code: (dl )
1
2
3
4
5
6
7
8
9
while (my $row = $sth->fetchrow_hashref) {
for $row->{Db} (@{$where{NEW_DB}}) {
for $row->{User} (@{$where{NEW_USER}}) {
print "INSERT INTO DB ";
print join(",", map { "$_:'$row->{$_}'" } keys %{$row});
print ";\n";
}
}
}
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread for-Schleife: Laufvariable als Referenz