Manual

- Overview
- Tutorials
- FAQs
- History / Changes
- License

Reference

- Language
- Functions
- Operators
- Special Variables
- Pragmas
- Utilities
- Internals
- Platform Specific

Modules

- A • B • C • D • E
- F • G • H • I • L
- M • N • O • P • S
- T • U • X

News / Blogs

- Perl Buzz
- Perl Iron Man
- Perlsphere
- Planet Perl
- TPF news
- Use Perl

See also

- CPAN
- Perl.org
- Perl.com
- Perl 5 Wiki
- Perl Jobs
- Perl Mongers
- Perl Monks

Contact

- Site designed and maintained by Jon Allen (JJ)
- http://perl.jonallen.info

- View the project page and FAQs

# values

Perl 5 version 10.1 documentation
Go to top

# values

Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

- values HASH

  Returns a list consisting of all the values of the named hash. (In a scalar context, returns the number of values.)

  The values are returned in an apparently random order. The actual random order is subject to change in future versions of perl, but it is guaranteed to be the same order as either the `keys` or `each` function would produce on the same (unmodified) hash. Since Perl 5.8.1 the ordering is different even between different runs of Perl for security reasons (see "Algorithmic Complexity Attacks" in perlsec).

  As a side effect, calling values() resets the HASH's internal iterator, see "each". (In particular, calling values() in void context resets the iterator with no other overhead.)

  Note that the values are not copied, which means modifying them will modify the contents of the hash:

          for (values %hash) 	    { s/foo/bar/g }   # modifies %hash values    for (@hash{keys %hash}) { s/foo/bar/g }   # same

  See also `keys`, `each`, and `sort`.

Recently read

Tools

- Preferences