in reply to Re^2: DBI & processing groups of rows
in thread DBI & processing groups of rows

Well, if you don't care about memory consumption, you can always create all the groups first

my @group; while (my $row = $sth->fetchrow_hashref) { push @group, [] if !@group || $row->{foo_id} == $group[-1][0]{foo_id}; push @{$group[-1]}, $row; } process($_) for (@group);

Replies are listed 'Best First'.
Re^4: DBI & processing groups of rows
by Anonymous Monk on Apr 15, 2011 at 06:05 UTC
    Thank you for your input. I ended going with the format I wrote in the original post (although with the else block removed to reduce indentation)