perl 散列

jrhmpt01:/root/wx# cat s11.pl 
$m = {
          'List' => [
                      {
                        'Val' => 646985052,
                        'Key' => 1
                      },
                      {
                        'Val' => 646985349,
                        'Key' => 2
                      },
                      {
                        'Val' => 646985306,
                        'Key' => 3
                      },
                      {
                        'Val' => 1454028541,
                        'Key' => 1000
                      }
                    ],
          'Count' => 4
        };




use Data::Dumper;

  ##散列
  $count=$m->{Count};
  print "$count is $count
";
  for ($i = 0;$i <= $count-1;$i++){
  print $m->{List}->[$i]->{Val};
print "
";
  print $m->{List}->[$i]->{Key};
print "
";
  $hash{$m->{List}->[$i]->{Key}}=$m->{List}->[$i]->{Val};
  $synckey .="$m->{List}->[$i]->{Key}\_$m->{List}->[$i]->{Val}|";
    
    };
	 
jrhmpt01:/root/wx# perl s11.pl 
$count is 4
646985052
1
646985349
2
646985306
3
1454028541
1000

原文地址:https://www.cnblogs.com/hzcya1995/p/13351056.html