Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   How to create multiple array variable in a loop (http://www.go4expert.com/forums/create-multiple-array-variable-loop-t14715/)

kalaid 23Oct2008 16:33

How to create multiple array variable in a loop
 
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

pradeep 25Nov2008 19:03

Re: How to create multiple array variable in a loop
 
Code: Perl

for($i=0;$i<10;$i++)
{
  $j=$i+1;
  eval
  {
    \@arr$j[$i]="some value";
  };
}



All times are GMT +5.5. The time now is 03:13.