--- name: keys status: documented runtime: pp source: src/runtime/pp/aggregate.rs --- ```{index} single: keys; Perl built-in (pp runtime) ``` # keys ## Synopsis ```perl my @k = keys %hash; my $count = keys %hash; # scalar context: number of keys for my $key (keys %hash) { ... } ``` ## Description Returns all keys of a hash, or the number of keys in scalar context. In list context, pushes all keys of the hash onto the stack as individual string values. In scalar context, returns the number of key-value pairs. Accepts both `%hash` and `$hashref` (auto- dereferences). As a side effect, resets the hash's internal iterator used by `each`. ## See also values, each, exists, delete