You have already combined arrays when adding elements to an array. The point is, combining two arrays is no different than adding elements to an array. Here is the scenario. You have two lists, each 10 names long. You have to combine them into a single list of 20 names.
Combining arrays
How to do it...
The process is simple. This is the flow we are going to follow:
- Import the contents of the first file into a variable
- Import the contents of the second file into another variable
- Combine the arrays
And this is the script that will help you with this:
$ListOne = Get-Content ./ch09/05-list-one.txt $ListTwo = Get-Content ./ch09/05-list-two.txt "List one contains $($ListOne.Count) items." "List two contains $(...