Re: Array reformatting problem



minky arora wrote:
Hello Team,

I have a problem and I need some ideas to put me on the right track to
form an algo:

I have four 8x12 arrays (Arr1,Arr2, Arr3,Arr4) and ONE 16x24 (ARR5) array.

Now these four arrays are formatted in a particular way by a robot(
these are actually plates with wells ..I am dealing with
Bioinformatics)

I need to write a perl script to automate the reformating of these
four arrays into the one larger array.I knw the pattern that it has to
follow, for example Arr1[1][1] ->ARR5[1][2] and so on.

Given a pattern is there a good programming practice to automate the
process?Ofcourse I can run loops and make it messy.

Many thanks in advance,



It all depends on how @Arr5 is built from the others.

If you want it in the form:

[ Arr1 Arr2
Arr3 Arr4 ]

then:

@arr5 = ();
for my $i ( 0 .. 7 ){
push @arr5, [ @{$arr1[$i]}, @{$arr2[$i]} ];
}
for my $i ( 0 .. 7 ){
push @arr5, [ @{$arr3[$i]}, @{$arr4[$i]} ];
}



--
Just my 0.00000002 million dollars worth,
Shawn

"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
.



Relevant Pages

  • Array reformatting problem
    ... form an algo: ... Now these four arrays are formatted in a particular way by a robot( ... Given a pattern is there a good programming practice to automate the ...
    (perl.beginners)
  • Re: Array reformatting problem
    ... form an algo: ... You are not talking about arrays in Perl are ... Given a pattern is there a good programming practice to automate the ...
    (perl.beginners)
  • Two-dimensional pattern matching/compression
    ... I am not quite sure if this is the right place to /discuss/ aspects of two-dimensional pattern matching. ... There exist q two-dimensional arrays A with an individual number of rows r and columns c each. ... The largest "common area" of any array shall merge with any other array into a single new superarray such, that they become part of a superarray and could be extracted individually without any loss of information, as long as their start coordinates within the superarray and their dimensions are known. ...
    (comp.theory)
  • Re: NuuBee Reinforcement question
    ... EAW JF80? ... Small line arrays are actually less useful than you might expect, ... pattern from a small line array. ... C'est suisse, et tres, tres precis." ...
    (rec.audio.pro)
  • Re: Comparing memory with a constant
    ... void switchonpattern(const char *pattern) ... What if a pattern contains a 0 byte? ... If you want arrays, use arrays and ...
    (comp.lang.c)