... loop: foreach ( @arr_vars ){ while( (my $key, my $value) = each %mapped_vars){ ... if ( $_ eq $key ) { ... next loop; } }