A summary of the use of Kazakhstan in Perl
To assign values to a hashing value pair with a fat arrow
%some_hash = (' jim ' => ', ' Tom ' => ', ' Jerry ' => ' 21 ');
Convert Hash to List
%any_hash = (K1, ' v1 ', K2, ' v2 ', K3, ' v3 ', K4, ' V4 ');
@arr =%any_hash;
The keys function that extracts the keys from the hash, for example, into an array @k
My @k = Keys%any_hash;
Values function that extracts the value of the hash, for example, into an array @v
My @v = values%any_hash;
Each function extracts the keys and values from the hash, such as the return key-value to $k, $v
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/
while ($k, $v) = each%any_hash) {
Print "$k => $v \ n";
}
exists function, check to see if a key exists in the hash, return true if there is a false
if (exists $any _hash{k1}) {
Print "This key exists.\n";
}
Delete function, deleting the keys in the hash
Delete $any _hash{k2};
[Not finished]
This article is from the "Strive for" blog, please be sure to keep this source http://carllai.blog.51cto.com/1664997/1175028