1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How to create multiple array variable in a loop

Discussion in 'Perl' started by kalaid, Oct 23, 2008.

  1. kalaid

    kalaid New Member

    Joined:
    Jul 21, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    In php code to create multiple array variable using loop and assign value will be as below

    for($i=0;$i<10;$i++)
    {
    $j=$i+1;
    $arr$j[$i]="some value";
    }
    Above code will create array variable from arr1 to arr10 and assign value.

    I want to convert same code to perl , how can i do this
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    Code:
    for($i=0;$i<10;$i++)
    {
      $j=$i+1;
      eval
      {
        \@arr$j[$i]="some value";
      };
    }
    
     

Share This Page