in reply to Getting specific variable data per row.
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."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Getting specific variable data per row.
by c_lhee (Novice) on Nov 28, 2001 at 13:34 UTC |