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

This worked like a charm, Thanks!

Better yet, I think I can make some sense out of how the references work.

one question: In the line:

for my $word ( keys %{ $hash{ $w1 }{ $w2 }{ words } } ) {

What does 'keys' stand for? Is it a reference?

Thank you very much for your help!

-mox

Replies are listed 'Best First'.
Re^3: importing all the values stored in an HoH into an array
by johngg (Canon) on Oct 31, 2006 at 13:48 UTC
    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

      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
Re^3: importing all the values stored in an HoH into an array
by davorg (Chancellor) on Oct 31, 2006 at 13:46 UTC
    What does 'keys' stand for? Is it a reference?

    'keys' is a Perl built-in function. It returns a list of the keys in a given hash. You should read the documentation (which I already pointed you to above).

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg