I have a large hash from which I want to pass a portion of it to a subroutine. My problem is, how do I dereference it within the subroutine?
report_block(\$report_data{$domain}{$provider});
sub report_block
{
my ($rpt_ref) = shift;
print Dumper($rpt_ref);
#access elements here!
}
That dump yields:
$VAR1 = \{
'error' => 0,
'total' => 7,
'soft_error' => 0,
'hard_error' => 0,
'ok' => 7
};
But I can't seem to figure out how to access the individual elements. After searching around I've tried the following, but neither of them are what I need.
print $rpt_ref{total};
#Global symbol "%rpt_ref" requires explicit package name...
print $rpt_ref->{total};
#Not a HASH reference at...
Obviously something escapes me here. ;)