in reply to Confused on Scalar/Hash
That's a scalar that contains a reference to a hash.
Observe (untested):
my %hash = ( a => 1, b => 2, ); my $href = \%hash;
The coder just skipped the intermediary step of taking a reference to the hash, and instead constructed it as a hash reference directly. To get information from the hash as I depicted above, you access it normally:
my $thing = $hash{a};
In the case of the hash reference, you have to dereference first:
my $thing = $href->{a};
You can dereference the entire hash reference and put it into a new hash if you please, but there's not often reason to do so unless you need a copy of the entire structure:
my %hash = %{ $href };
See perlreftut.
|
|---|