Results 1 to 2 of 2

Thread: Array

  1. #1
    Join Date
    Jul 2003
    Posts
    2

    Unanswered: Array

    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??

  2. #2
    Join Date
    Sep 2002
    Location
    Germany, near Aachen
    Posts
    120
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •