in reply to Re^2: Printing Categories from SQL search
in thread Printing Categories from SQL search

G'day htmanning,

"Is there anything wrong with this?"

The use of smart matching (~~) is experimental, so that's not good. It also looks like you're using (global) package variables: not good either - put use strict; at the start of your code and see what that tells you.

I rather agree with ++afoken's comment about using the SQL to get rid of the duplicates; however, for cases where you don't have that option, the classic, general solution would be something like:

my %seen; while (...) { next if $seen{$_}++; print; }

You introduced @list which didn't exist in your OP. You already have the data that's in that array:

keys %seen

— Ken