PDA

View Full Version : Array


xDamox
07-07-03, 16:47
Hi all,

I have been doing some programming in Perl and I was wondering How could I put array information into varibles??

I dont mean by doing:

#!/usr/bin/perl -w
#
#
#

@Array = ("Damo", "dbforums", "Damo2");

$Array[0];


How could I do it so like I have my Array with the Names in and I could make there own varibles for it any one have any ideas??

Bernd Dulfer
07-08-03, 05:48
I don't quite understand what you want to achieve.

Do you want to create variables that have their names from the contents of the array?

You can do this with symbolic references like this:

@array = ('abc', 'def', 'ghi');
${$array[0]} = 8;
print "$abc\n" # prints 8