Note of Learning Perl--Hashes

Hashes
-------------

1. Keys and Values
 1) Technically, Perl rebuilds the hash table as needed for larger hashes. In fact, the term "hashes" comes from the fact that a hash table is used for implementing them.
 2) The keys and values are both arbitrary scalars, but the keys are always converted to strings. So, if you used the numeric expression 50/20 as the key, it would be turned into the three-character string "2.5".
 3) The keys are always unique, although the values may be duplicated. The values of a hash may be all numbers, all strings, undef values, or a mixture. But the keys are all arbitrary, unique strings.
 
2. Hash Element Access
 1) To access an element of a hash, use syntax that looks like this:
  $hash{$some_key}
 2) To refer to the entire hash, use the percent sign ("%") as a prefix.
 3) For convenience, a hash may be converted into a list, and back again. Assigning to a hash is a list-context assignment, where the list is made of key-value pairs.
 4) To Perl, it's just a different way to "spell" a comma. That is, in the Perl grammar, any time that you need a comma ( , ), you can use the big arrow instead; it's all the same to Perl.

3. Hash Functions
 1) keys and values
 2) each
 3) exists
 4) delete

你可能感兴趣的:(perl,Access)