One option in deduplication is usually a hash:
my %cats; while (my $pointer = $sth->fetchrow_hashref) { $cats{$pointer->{category}} = 1; } for my $category (keys %cats) { print "$category\n"; }
See also the FAQ How can I remove duplicate elements from a list or array?
Update: typo now fixed (line 3 was $cat{...}). Thanks wjw for spotting.
In reply to Re: Printing Categories from SQL search
by hippo
in thread Printing Categories from SQL search
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |