Not Selected:

    % for my $c (@nots) {
  • <% $all{$c} |h %>
  • % }
Ordered Choices:

    % for my $c (@comics) {
  • <% $all{$c} |h %>
  • % }

Done
<%init> my $user; unless (defined($user = $m->comp('m/get_user'))) { $m->comp('/m/redirect', 'login.html'); } my %all = $m->comp('m/get_comics'); ## recover user prefs my $dbh = $m->comp('m/connect'); my $sth = $dbh->prepare('select comics from user where user = ?'); $sth->execute($user); my @comics = split(/,/, ($sth->fetchrow_array)[0]); $sth->finish; $dbh->disconnect; my @nots; for my $c (keys(%all)) { push(@nots, $c) unless grep { $c eq $_ } @comics; } @nots = sort { lc($all{$a}) cmp lc($all{$b}) } @nots;