bucket_ratio#

Return a "used/total" string describing how many of the hash’s internal buckets hold at least one key.

Synopsis#

my $r = bucket_ratio(%hash); # e.g. “5/8”

Behaves like the pre-5.25 scalar(%hash): for a tied hash it calls the SCALAR tie method; for a normal empty hash it returns 0; otherwise it reports the count of non-empty buckets followed by a slash followed by the total bucket count.

Useful when eyeballing load factor on a large hash. For a structured report reach for bucket_stats or bucket_stats_formatted instead.