my %seen; while (my $ref = $pdbh->fetchrow_hashref()) { for (qw(mon tue wed thu fri sat sun)) { my $result = lcfirst($_).$ref->{$_} if $ref->{$_}; if ($seen{$result}++) { warn "$seen found already"; } else { push @results,$result; } } } print join("\n",@results); #### -- Joost downtime n. The period during which a system is error-free and immune from user input.