I'm new to powershell. Why does the array get mangled (seems like it gets concatenated???) when passed to the function test
? I have no idea what's going on. Works OK if the function only has one parameter, but adding a second parameter makes it act up. I've tried googling, but can't come up with the right terms.
function test([string[]] $arrInFn, [boolean] $something) {
Write-Host "Array length in function: $($arrInFn.Length)"
}
$arr = @()
$arr += "test"
$arr += "another entry"
$arr += "third entry"
Write-Host "------------------ TEST OUTPUT-------------------"
Write-Host "Array length inline: $($arr.Length)"
test $arr, $true