Your code is a little confusing (what is the point of initialize? What does dummyvoid do? Why is $row a global variable?) but I think this will do what you want.
my $prev_team = ''; while (my $row = $sth->fetchrow_hashref) { if ($row->{team} eq $prev_team) { print "\t$row->{idx}\n"; } else { print "$row->{team}\t$row->{idx}\n"; } $prev_team = $row->{team}; }
Update: Hofmator points out (correctly) that this only works if your SQL query sorts by team name.
--"The first rule of Perl club is you don't talk about Perl club."
In reply to Re: Getting specific variable data per row.
by davorg
in thread Getting specific variable data per row.
by c_lhee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |