While this is possible, you don't want that. Read Why it's stupid to use a variable as as a variable name to get a discussion of the perils and the solutions.
You should put your data into an array instead of collecting it into numbered variables.
I'm quite confident that somebody will show you the way how to use strings as variable names, but you shouldn't use that but first think long and hard about the problem you're trying to solve, and the alternatives that Perl offers you, like hashes and arrays. If an array does not suit your needs, then a hash sure will:
my %numbers = ( num1 => 1, num2 => 2, ... num10 => 10, ); # which can be constructed programmatically as: my %numbers = map { "num$_" => $_ } (1..10);
In reply to Re: Creating variables for each array member
by Corion
in thread Creating variables for each array member
by sashac88
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |