I\'m trying to loop through a hash table and set the value of each key to 5 and PowerShell gives an error:
$myHash = @{} $myHash[\"a\"] = 1 $myHash[\"b\"] =
$myHash = @{ Americas = 0; Asia = 0; Europe = 0; } $countries = @("Americas", "Asia", "Europe", "Americas", "Asia") foreach($key in $($myHash.Keys)) { foreach($Country in $countries) { if($key -eq $Country) { $myHash[$key] += 1 } } }
Updating a hash value if array elements matched with a hash key.