Given an array like this
$array = @('A', 'B', 'C', 'D', 'E')
I can append something to the end of each item in the array like so
$array = $array | Foreach-Object {"$_ *"}
And if I want to append something DIFFERENT to each member I can do so like this
$tempArray = @()
$count = 1
foreach ($item in $array) {
$tempArray += "$item $count"
$count ++
}
$array = $tempArray
But that use of a temporary array seems... clumsy. I feel like I am missing something that would allow conditionally changing the values of the original array instead. Not adding new items, just changing the value of existing items.