sub debug
{
 # Debugging function to print out a sorted 2D hash.
 # Usage: debug(\%hash);
 
 my %data = %{$_[0]};
 my @keys = sort { $data{$b}{'entry'} <=> $data{$a}{'entry'} } keys %data;
 foreach my $key (@keys){
  foreach my $subkey (sort keys %{$data{$key}}){
   print '$data{'.$key.'}{'.$subkey.'} = '.$data{$key}{$subkey}."<br>\n";
  }
 }
 exit;
}
1;