且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将两个散列与键和值进行比较

更新时间:2023-01-21 12:19:12

以下内容应该可以帮助您了解:

The following should help you get an idea:

for ( keys %hash1 ) {
    unless ( exists $hash2{$_} ) {
        print "$_: not found in second hash\n";
        next;
    }

    if ( $hash1{$_} eq $hash2{$_} ) {
        print "$_: values are equal\n";
    }
    else {
        print "$_: values are not equal\n";
    }
}