$hash_map{$key}->{$value1} = 1;
I’m just a beginner at perl and I need help in this expression, what does this expression mean? I assume that a new key/value pair will be created but what is the meaning of 1 here?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you’ve got here is a hash of hashes, or a two-level hash.
$hash_map{$key}holds a hash reference, which points to another hash.$hash_map{$key}{$value}(the arrow can be omitted in this case) is a particular key in the second hash. The1is the value being assigned to that hash key.For more on this topic, see Perl Data Structures Cookbook section on Hashes of Hashes, and also see the Perl reference tutorial for how references work.