Hey guys, I was trying to create in a 2-D array in my hash tag(well, it's kinda like a 3-D I guess).. When I tried to initialize it, I did something like:
and when I push stuff into the array, I did:my @array=(); $exonHash{$exonNumber}=\@array; #exonHash is the hashtag my @twoD_array0=(); my @twoD_array1=(); my @twoD_array2=(); my @twoD_array3=(); my @twoD_array4=(); $array[0]=\@twoD_array0; $array[1]=\@twoD_array1; $array[2]=\@twoD_array2; $array[3]=\@twoD_array3; $array[4]=\@twoD_array4;
It works in windows IDE, but out of no reason, after I upload it to linux, it gives error as Type of arg 1 to push must be array (not array slice) at average.pl line 86, near "$min)", which is saying the arrays are invalid. Do I have better ways to initialize arrays like this or did I make a mistake somewhere? Thank you very much.push(@{$exonHash{$exonNumber}}[1], $q1); push(@{$exonHash{$exonNumber}}[2], $med); push(@{$exonHash{$exonNumber}}[3], $q3); push(@{$exonHash{$exonNumber}}[4], $max);
In reply to 2D array in Perl by Perl_ca_user
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |