On Wed, Jul 31, 2002 at 11:50:47AM -0700, nkuipers wrote: > Hello everyone, > > I want to count hash keys. I originally tried > > my $count = scalar %hash; > > which when printed gave the string 411/1024. I looked this up in > perldoc perldata and sort of understand the significance of this result in > terms of buckets. > > So I tried this in a driver where I varied the size of the test hash: > > my $count = scalar (keys %hash); > print "$count\n"; > > and it seemed to work. I just want to make sure that this is in fact a true > result that applies to hashes of any size, and not some crazy perl-guts > coincidence.
Yes, this is guaranteed to work. You don't even need to explicitly mention scalar. > I skimmed the llama, camel, and cookbook, but I guess what I am wanting to do > is so basic it doesn't need [readily apparent] mention. perldoc -f keys -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]