perl return key and the hash value and the

#! / usr / bin / Perl
#! / usr / bin / Perl

% Data = ( 'Google' => 'Google.com', 'runoob' => 'runoob.com', 'taobao' => 'taobao. COM ');

@names Keys% = Data; # all the hash function returns an array of all the key
# is noted that the array
Print "$ names [0] \ n-";
Print "$ names [. 1] \ n-";
Print "$ names [2] \ n ";

DATA2 =% ( 'Google' => 'Google.com', 'runoob' => 'runoob.com', 'taobao' => 'taobao.com');

@urls% = values DATA2; # This function returns all the hash value of all array
# note the array
Print "$ URLs [0] \ n-";
Print "URLs $ [. 1] \ n-";
Print "$ URLs [2] \ n-";

Guess you like

Origin www.cnblogs.com/shunguo/p/11441667.html