in reply to sorting not sort

So you want to sort by affinity first, and by string second?

print map{ "<p> $_ = $strings{$_} </p>\n" } sort{ $strings{$b} <=> $strings{$a} or $a cmp $b } keys %strings;

I think that's what you're asking for. By the way, have you had a chance to read the documentation for sort yet? It can prove helpful.

Also note, it's a big mistake to start naming your variables $afinity1c, $afinity2c, $afinity3c ... $afinity200c. That's going to lead you down a road toward a desire to use symbolic references, and that road leads to hell (or worse!). Use an array when you want an array. perlintro discusses the basics of arrays and hashes.


Dave