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
I have removed the errors in the code: for($i=0;$i<10;$i++) { $j=$i+1; $arr[$j[$i]="some value"; } Now, the same code should work in PERL.
#!D:\Perl\bin\perl print "Content-type: text/html\n\n"; print "<b>Hello, world</b>"; $data_file="E:/LogAnalyzer/exim_mainlog.22"; open(FETs, $data_file) || die("Could not open file!"); @raw_data=<FETs>; $j=0; foreach $val (@raw_data) { @chars = split(/ /, $val); for($i=0;$i<8;$i++) { $j=$i+1; $arr$j[$i]=$chars[$i]; } } print @arr1; print @arr2; In the above code i cannot create multiple array name based on loop value and assign value. Please rectify issue in the above code