good chemistry is complicated,and a little bit messy -LW PerlMonks

### Comment on

 Need Help??
Hi, Im new here and somewhat new to PERL. Im trying to learn how to apply some PERL to our research data. I seem to run into a problem when I want each for-loop to create a separate array from that loop. In my makeshift solution below I made an array within an array, where each array in the AoA represents a number of values for each sample. The problem then, is that I cannot extract each array and put into a separate array, it seems to be a easy question, perhaps the answer is to obvious. @A = @B[0]; This did not work to transfer the first array into a separate array. It also presents a problem because I would need to declare X new arrays (one for each sample) and then Im back in the looping and declaring. Any help or suggestions would be appreciated Cheers Oskar
```#!/usr/bin/perl
use strict;
my (\$antal);
my (\$size);

print "How many replicates? ";
\$antal = <stdin>;
print "How many Samples? ";
\$size = <stdin>;

my (\$tam);
my (\$tim);
\$tim = 0;
my (\$x);
my (@a);
my (\$repvalue);
my (\$repvalue2);
\$repvalue2 = 1;
for (\$x=0; \$x<\$size; \$x++) #For each Sample the number of replicat
+es are entered
{
for (\$tam=0; \$tam<\$antal; \$tam++ ) #For each replicate in the
{
\$repvalue = \$tam+1;
print "Imput replicate value \$repvalue for sample \$repvalu
+e2: ";
\$a[\$tim][\$tam] = <stdin>;
}
\$repvalue2++;
\$tim++;
print "\n";
}
my (\$n);
my (\$m);
my (\$n2);
my (\$m2);

for (\$n = 0; \$n<\$size; \$n++) #For printing and checking all values
{
print "\n\n";
\$n2 = \$n+1;
print "Replicates of sample \$n2:\n\n";
for (\$m=0; \$m<\$antal; \$m++)
{
\$m2 = \$m+1;
print "Replicate \$m2 value is: \$a[\$n][\$m]";
}
print "\n\n";
}

In reply to Getting out an array within an array by sokatron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
 Discipulus anyway xp is still the best lowend game machine [Discipulus]: both: everyting must be identical in the new v-machine [Lady_Aleena]: So putting a nice DE or WM up on a Linux machine is not an option? [Discipulus]: i need some converter to have directly an OVF format directly: at the moment i'm trying with vmware converter standalone [Lady_Aleena]: I don't know what to tell you. I can barely get my Linux machine to do things I want. [Discipulus]: if DE or WM means desktop env and win manager.. no, not an option [Lady_Aleena]: That's what they mean, at least to me. 8) [Discipulus]: in the first attempt i failed, with an not usable v-machine.. ;=) [Discipulus]: but then discovered a registry trick to do before the physical2virtual migration [Lady_Aleena]: Sounds like a headache.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2017-05-22 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favorite model of computation is ...

Results (174 votes). Check out past polls.