Yes, but you probably don't want to do it:
no strict 'refs';
my $point1 = 'valpt';
@$point1 = (1,2,3);
# symbolic reference
print @valpt;
Or (your specific request):
no strict 'refs';
my $point1 = 'valpt';
eval "\@use_$point1 = (1,2,3)";
print @use_valpt;
For several security and bug-hunting reasons, this is a very bad idea. What you probably want is a hash instead...
my $point1 = 'valpt';
my @array = (1,2,3);
$foo{ "use_$point1" } = \@array;
# hard reference to array stored in hash %foo
print @{ $foo{ 'use_valpt' } };
# dereference arrayref stored in %foo under 'use_valpt' key
You can then access your data by the name chosen in $point1 without worrying about creating global variables all over the place. Have a look at perlref.
|