How do I do foreach loop with a where clause for a multidimensional array in Powershell?
For example $people = @( @(‘adam’, ’24’, ‘M’) @(‘andy’, ’20’, ‘M’) @(‘alex’, ’30’, ‘M’) @(‘ava’, ’25’, ‘F’) ) foreach($person in $people | where ($person[1] -lt ’25’) -and ($person[2] -eq ‘M’)) and this should select adam and andy… >Solution : The syntax you should use for your Where-Object statement would be: $people = @( @(‘adam’, ’24’,… Read More How do I do foreach loop with a where clause for a multidimensional array in Powershell?