keys() function in
Perl returns all the keys of the HASH as a list. Order of elements in the List need not to be same always, but, it matches to the order returned by values and each function.
Syntax: keys(HASH)
Parameter:
HASH: Hash whose keys are to be printed
Return: For scalar context, it returns the number of keys in the hash whereas for List context it returns a list of keys.
Example 1:
Output:
Values are 11-12-13-10
Keys are Eleven-Twelve-Thirteen-Ten
Example 2:
Output:
Values are 3-2-1
Keys are Geeks-For-Geek