I think you want to do a string eval.
$i = 0;
foreach my $var (@rray) {
my $str = '$'.$var.'_'.$i.' = "put value here";';
eval $str;
die "eval error: $@" if ($@);
$i++;
}
Greg
"James Linden Rose, III" wrote:
>
> Men and women of Perldom,
>
> Can somebody remind me of how you can take an array full of names and
> turn them into variable names?
>
> Simplified from reality, I want to do something like this:
>
> $i = 0;
> foreach (@rray) {
> $$_ = $i;
> $i++;
> }
>
> Where the result is a variable named $name_1, $name_2, ... $name_n.
>
> And of course, my construction above is not it, and my aging memory
> is failing me. Can any of you kind wizards spare a moment to remind
> of the process...
>
> James
--
Greg London
x7541