in reply to Adding a number from scalar variable to array name

It might be easier to just use a hash. Then it would be:
foreach $num (@numbers) { $store_get{$num}=$num; }
Also, if you're just assigning one number to each of the arrays, you can just access the array element directly:
$numbers[$num-1]
is equal to $num from when you set up the array. I hope this helps.

Replies are listed 'Best First'.
Re^2: Adding a number from scalar variable to array name
by Anonymous Monk on Sep 08, 2006 at 18:51 UTC
    Well I want to store more than one variable... Reason I want to do this is for example: I want my code to create the arrays @array1, @array2, @array3... Based on the number it gets from the original array (1,2,3.... ). I want @array1 = (1,2,3), @array2 = (4,5,6), etc
      Well I want to store more than one variable...

      Why? (BTW: you are confusing variable and named variable).

      Reason I want to do this is for example: I want my code to create the arrays @array1, @array2, @array3... I want @array1 = (1,2,3), @array2 = (4,5,6), etc

      That's not a reason, it's just a restatement of the assertion that you want more than one named variable.

      Please look deep within youself and see if you can actually find a reason why you want this.