帮我看下程序好吗?——两个hash数组的调用

帮我看下程序好吗?——两个hash数组的调用

帮我看下程序好吗?――两个hash数组的调用
my %hash = (
   '10' =>['two',0,2],
   '20' =>['one',1,3],
   '30' =>['three',4,5],
   );
my %ext = (
   '1A' => ['four',1],
   '2A' => ['fine',2],
   '30' => ['six',3],
   );
my $key; my $value; my $key1; my $key1;
($key, $value) = each %hash;
 ($key1, $value1) = each %ext;
@str=(" ","a a","FIS 0x10 s","FIS 0x2A=2","cc");

for $str (@str) {
 if($str=~/(FIS.*0x)((\d|\w)(\d|\w))/)
   { print $2."\n";
    for $key (keys %hash)
     { #print $2."\n";
     if ($2 =~ /$key/)
      { print $key; print $hash{$key}[0]."\n"; }
     else { last ;}
    }
    for $key1 (keys %ext) {
     if ($2 =~ /$key1/)
     { print $key1; print $ext{$key1}[0]."\n"; }
     else {print"error";}
    }
 }
}

结果不对,所得正确结果应是:
10 two
2A fine
问题已解决。thanks Longbow!
问题已解决。thanks Longbow!