I would like to compare two arrays and use the differencing value to return another value from another array.
With this snippet I am able to determe that "b" from $array1 is not contained in $array2. However, I don`t know how to link "b" to 2 in $array3 and return that value.
$array1 = (@("a","b","c"))
$array2 = (@("a","c"))
$array3 = (@(1,2,3)) # 1 should be linked to "a", 2 to "b" and 3 to "c"
$array1 | ForEach-Object {If ($_ -notin $array2) {$_}}
I appreciate your help.
Thanks.