in reply to Custom HOA printing

The following does what gives the output you want:
for my $key (reverse sort keys %hash) { print "\n<b>$key chars</b><br>\n"; foreach my $element (@{$hash{$key}}) { print "<a href=\"link.pl?=$element\">$element</a>"; } print "<br><br>\n"; }
Although I'm not sure if this is what you were after (I got rid of the join)

Update: The solution given by atcroft below is probably the more "Perl-ish" way to do it.
Update 2:Fixed code so that <br><br> is printed after each set of array elements (thanks ysth).

Cheers,
Darren