if( not(grep { check_coord($xCur, $yCur, $wall, $_) ne $test1{$_} } keys %test1) or not(grep { check_coord($xCur, $yCur, $wall, $_) ne $test2{$_} } keys %test2) ) { }