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

Thanks, I see that now. Although I don't understand how it is a reference at that point. Prior to that point it is declared and I've simply been populating it via:
my %report_data; ... $report_data{$domain}{$provider}{ok}++;

Replies are listed 'Best First'.
Re^5: Dereferencing a portion of a hash
by RazorbladeBidet (Friar) on Feb 18, 2005 at 17:22 UTC
    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