hash variable

A hash, also called an associative array, is an array in which “key” and “values” are associated as a pair. However, the array itself is characterized by being unordered. A hash variable is called a hash variable, which starts with %(percent) + 1 alphabetic character, and can use numbers, alphabetic characters and underscores (_) thereafter. Also, because case is distinguished, % and % A, for example, are treated as different things.

%fruit = ("red"=>"apple", "yellow"=>"banana");
print "$fruit{'red'}\n";

$fruit{"red"} = "apple";
$fruit{"yello"} = "banana";

%fruit = (red => "apple", yellow => "banana", purple => "grape");
@file = keys %fruit;

@file = values %fruit;
print "@file\n";

($key, $val) = each %fruit;
print "$key: $val\n";