my $count=scalar keys %hash; #or $count=scalar(keys(%hash));