ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
5.2 Hash VariablesA hash variable name is a percent sign ( Rather than referencing the entire hash, more commonly you create and access the hash by referring to its elements. Each element of the hash is a separate scalar variable, accessed by a string index, called the key. Elements of the hash As with arrays, you create new elements merely by assigning to a hash element: $fred{"aaa"} = "bbb"; # creates key "aaa", value "bbb" $fred{234.5} = 456.7; # creates key "234.5", value 456.7 These two statements create two elements in the hash. Subsequent accesses to the same element (using the same key) return the previously stored value: print $fred{"aaa"}; # prints "bbb" $fred{234.5} += 3; # makes it 459.7 Referencing an element that does not exist returns the |