Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL keys Function
Syntax
Definition and Usage
Returns all the keys of the HASH as a list. The keys are returned in random order but,
in fact, share the same order as that used by values and each.
Return Value
Example
Try out following example:
#!/usr/bin/perl
%hash = ('One' => 1,
'Two' => 2,
'Three' => 3,
'Four' => 4);
@values = values( %hash );
print("Values are ", join("-", @values), "\n");
@keys = keys( %hash );
print("Keys are ", join("-", @keys), "\n");
|
It will produce following results:
Values are 4-3-2-1
Keys are Four-Three-Two-One
| |
|

|
|
|