I have a few arrays as shown below.
$a1 = "apple"
$a2 = "ball"
$a3 = "cat"
$a4 = "dog"
$a5 = "egg"
Now, I am trying to store the values of the above arrays in a separate array as shown below.
$array = @()
for($i = 1; $i -le 5; $i++) {$array += "$" + "a$i"}
Now $array give me the following
PS C:\> $array
$a1
$a2
$a3
$a4
$a5
PS C:\>
What I want now is if I can extract the value of array $a1which is apple, instead of the array's $array value $a1. I would like to extract the value "apple" of $a1 from $array. Somebody who has done this before, can you please shed some light on this. Thanks.
$a1 = "apple"is not an array