I want to zip two arrays, like how Ruby does it, but in PowerShell. Here\'s a hypothetical operator (I know we\'re probably talking about some kind of goofy pipeline, but I just
# Multiple arrays
$Sizes = @("small", "large", "tiny")
$Colors = @("red", "green", "blue")
$Shapes = @("circle", "square", "oval")
# The first line "zips"
$Sizes | ForEach-Object { $i = 0 }{ @{size=$_; color=$Colors[$i]; shape=$Shapes[$i]}; $i++ } `
| ForEach-Object { $_.size + " " + $_.color + " " + $_.shape }
Outputs:
small red circle
large green square
tiny blue oval