in reply to Re^2: importing all the values stored in an HoH into an array
in thread importing all the values stored in an HoH into an array

keys is a function for pulling out all the keys from a hash. There is also a values function for ... er ... pulling out the values. You should also be aware of each. Here is an example.

use strict; use warnings; my %dets = ( name => q{fred}, age => 33); while (my ($key, $value) = each %dets) { # Do something with key and value here }

Note that you can't predict the order in which these functions will present keys, values or key/value pairs.

I hope this is of use.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^4: importing all the values stored in an HoH into an array
by chinamox (Scribe) on Oct 31, 2006 at 14:02 UTC

    Thank you for the example. It makes sense that there would be no predictable order for how keys, values, or key/value pairs are presented because a hash is not indexed like an array is. Still, these three tools will be most useful in my future dealings with hashes.

    cheers

    -mox