in reply to dumping a hash
# Parens, not curlies my %hash = (this => "one", that => "two"); # Use a slash when dumping @var or %var print Dumper(\%hash); print($hash{this}, "\n");
Curlies create an anonymous hash and return a reference to that hash. Hashes are initialized from a list, not from a hash reference. Use parens (not curlies) to create a list.
If you wanted to work with a hash reference, use curlies, and assign the result of the curlies to a scalar.
my $hash = { this => "one", that => "two" }; print Dumper($hash); print($hash->{this}, "\n");
|
|---|