in reply to Combining hashes

You can leave off the explicit scalar if you are evaluating keys in a scalar context, as in:
my $count = keys %class1;
Regarding your second question, yes you can merge hashes together in a simple list. Perl transforms each hash into a list of key-value pairs, and the last value for any given key in the list is what is set in %merged:
my %merged = (%class1, %class2, %class3); my $count = keys %merged;
This version is somewhat more readable than your original one, at the expense of a little inefficiency.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print