in reply to Re^4: Dereferencing a portion of a hash
in thread Dereferencing a portion of a hash

You don't understand how $report_data{$domain}{$provider} is a reference?

If not, if you were to define things all at once it would be like this:

my %report_data = ( $domain => { $provider => { 'error' => '0', ... # other stuff here } } }


The reason it's a reference is because you have a scalar value (hash value $report_data{$domain}) pointing to a hash reference.

From perldoc -f perldata:


...
All data in Perl is a scalar, an array of scalars, or a hash of scalars
...
Although a scalar may not directly hold multiple values, it may contain a reference to an array or hash which in turn contains multiple values.
...


A hash isn't a scalar, it's a hash, but a reference is a scalar, so it can hold that in the value of the hash where the key is $provider.
--------------
It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs

Replies are listed 'Best First'.
Re^6: Dereferencing a portion of a hash
by THRAK (Monk) on Feb 18, 2005 at 18:53 UTC