Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL values Function
Syntax
Definition and Usage
Returns the list of all the values contained in HASH. In a scalar context, returns the number of values that would be returned. Uses the same iterator, and therefore order, used by the each and keys functions.
Check keys() function also
Return Value
Example
#!/usr/bin/perl -w
%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
| |
|

|
|
|