So, I have an interesting problem that I'm having no luck solving. I have a need to create a bunch of dynamic array variables.
code:
$temp = 'arr1=(1,2,3);arr2=(4,5,6);arr3=(7,8,9)'
foreach($item in $temp.split(";")){
$var = $item.split("=")
New-variable $var[0] $var[1]
get-variable $var[0]
}
Results:
$arr1 (1,2,3)
... (4,5,6)
... (7,8,9)
I have variable $temp which contains a semicolon delimited list of variables/values I want to create. As you can see above I am using new-variable to create this. What is interesting is when I run this from a script, new-variable works for the first call but then I get "..." for all other variables in the array. Any idea what might be causing this?