develooper Front page | perl.beginners | Postings from April 2010

Re: matching values of one hash to another

Thread Previous | Thread Next
From:
Jim Gibson
Date:
April 29, 2010 18:28
Subject:
Re: matching values of one hash to another
Message ID:
C7FF803B.A52F%JimSGibson@gmail.com
On 4/29/10 Thu  Apr 29, 2010  5:15 PM, "Harry Putnam" <reader@newsguy.com>
scribbled:

>> 
>> The braces ({}) mean that %data is a "hash-of-hashes", i.e., the values of
>> the elements of %data are references to hashes.
> 
> Needless to say, I'm a bit confused here.... googling on `hash of
> hashes' has plenty of hits, but looking through a few, so far has only
> helped confuse me.

Read 'perldoc perllol' and remember that arrays and hashes are similar.
Arrays are indexed by numbers, and hashes are indexed by strings. So most
everything that applies to 'array-of-arrays' applies to 'hash-of-hashes'.
And of course you can have 'array-of-hashes' and 'hash-of-arrays', to any
level.

These are extremely important data structures for Perl programming, so you
should figure out what they are.

Use the Data::Dumper module to see any complex, nested data structure:

    use Data::Dumper;
    my %data;
    ...
    print Dumper(\%data);



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About