|< 1 2 3 >| | 22 Einträge, 3 Seiten |
QuoteAllerdings wundert mich wirklich, was du fuer einen Code hast, in dem du unbedingt eine foreach-Schleife statt einer while-Schleife benoetigst?!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my $COLMAXITEM = 3;
my $idx = 0;
my @rows = ();
my $maxcount = scalar @item - 1;
while(my $it = $sth->fetchrow_hashref)
{
push @cols, {IMAGES_PATH => $images_path, IMAGESRC=> $it->{code}};
if(scalar @cols == $COLMAXITEM or $idx+1 == $maxcount)
{
push @rows, {COLS => [@cols]};
@cols = ();
}
$idx++;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my $COLMAXITEM = 3;
my $idx = 0;
my @rows = ();
my $maxcount = scalar @item - 1;
while(my $it = $sth->fetchrow_hashref)
{
push @cols, {IMAGES_PATH => $images_path, IMAGESRC=> $it->{code}};
if(scalar @cols == $COLMAXITEM or $idx+1 == $maxcount)
{
push @rows, {COLS => [@cols]};
@cols = ();
}
$idx++;
}
|< 1 2 3 >| | 22 Einträge, 3 Seiten |