I am sorry to send a personal advertisement here. If you are interested, you can view it:Http://www.wachnew.com
#! /Usr/bin/perl-W
$ Family_name {"Fred"} = "flinkstone"; # assign a value to the hash key
$ Family_name {"Barney"} = "rubble ";
Foreach my $ person (QW/Fred Barney/) # Write the private variable declaration to foreach
{
Print "the $ person is: $ family_name {$ person}/N"; # output key and corresponding key value
}
My % hash = (# create a hash and assign values to corresponding key/value pairs
"A" => 1,
"B" => 2,
"C" => 3,
"D" => 4,
"E" => 5,
);
My @ k = keys % hash; # extracts the hash Key List
My @ v = values % hash; # extracts the Hash Value List
My $ COUNT = keys % hash; # extract the logarithm of hash key value
Print "@ k/N". "@ V/N", "Number = $ count/N ";
If (% hash) # true if the hash is not empty
{
Print "OK/N ";
}
My % test;
If (% test)
{
Print "OK for test/N ";
}
Else
{
Print "false for test/N ";
}
While ($ key, $ value) = each % hash)
{
Print "$ key => $ value/N ";
}
# Sorting hash keys
Print "/N ";
Foreach $ key (sort keys % hash) # Sort the keys in the hash and put them in the value scalar one by one.
{
Print "$ key => $ hash {$ key}/N ";
}
# Getting system environment variable values
Print "The path is $ ENV {path}/N"; # obtain the system path address