Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: joinChapter 5
Function Reference
Next: Reference: kill
 

keys

keys %hash

Returns a list consisting of all the keys of the named hash. The keys are returned in an apparently random order, but it is the same order that either the values or each function produces (assuming that the hash has not been modified between calls).

In scalar context, keys returns the number of elements of the hash (and resets the each iterator).

keys can be used as an lvalue to increase the number of hash buckets allocated for the hash:

keys %hash = 200;


Previous: Reference: joinPerl in a NutshellNext: Reference: kill
Reference: joinBook IndexReference: kill

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.