Suppose there is an array in the variable $ a, which is created in such a way
$a = ,@(1,2,3) $a += ,@(4,5,6) $a += ,@(7,8,9) $a += ,@(10,11,12)
I want to extract part of an array, for example $ a [1] and $ a [2], into another variable, for example $ b such that
$b[0] = @(4,5,6) $b[1] = @(7,8,9)
I can use a simple loop to complete the task, but I think that if there is a more βelegantβ way to do this ... maybe one-line?
Thanks in advance.
arrays loops powershell
Barry chum
source share