<?xml version="1.0" encoding="windows-1252"?>
<node id="996743" title="Re: Getting out an array within an array" created="2012-10-01 16:47:53" updated="2012-10-01 16:47:53">
<type id="11">
note</type>
<author id="965102">
Kenosis</author>
<data>
<field name="doctext">
&lt;p&gt;Welcome, sokatron!&lt;/p&gt;
&lt;p&gt;[http://www.perlmonks.org/?node_id=647953|sundialsvc4] did an excellent(!) job addressing the concept of a &lt;em&gt;reference&lt;/em&gt; to assist you with resolving your array issue.&lt;/p&gt;
&lt;p&gt;Although unsolicited--and I apologize in advance if I've confused the issue here--consider the following which doesn't use the C-stype &lt;c&gt;for&lt;/c&gt; loop (e.g., &lt;c&gt;for ($x=0; $x&lt;$size; $x++)&lt;/c&gt;):&lt;/p&gt;
&lt;c&gt;
#!/usr/bin/perl
use strict;
use warnings;

print "How many replicates? ";
chomp( my $antal = &lt;&gt; );
print "How many Samples? ";
chomp( my $size = &lt;&gt; );

my @a; # Consider a more descriptive name for this array.

for my $tim ( 0 .. $size - 1 ) { #For each Sample the number of replicates are entered
	for my $tam ( 0 .. $antal - 1 ) { #For each replicate in the sample a value is added
		print 'Enter replicate value '
		  . ( $tam + 1 )
		  . ' for sample '
		  . ( $tim + 1 ) . ': ';
		  
		chomp( my $repValue = &lt;&gt; );
		
		$a[$tim][$tam] = $repValue;
		#push @{ $a[$tim] }, $repValue; # This notation can be used, too.  Is there a "Golden Ticket" here?
	}
	
	print "\n";
}

for my $tim ( 0 .. $size - 1 ) { #For printing and checking all values
	print 'Replicates of sample ' . ( $tim + 1 ) . "\n\n";
	
	for my $tam ( 0 .. $antal - 1 ) {
		print 'Replicate ' . ( $tam + 1 ) . " value is: $a[$tim][$tam]\n";
	}
	
	print "\n";
}
&lt;/c&gt;
&lt;p&gt;Hope this is helpful.&lt;/p&gt;</field>
<field name="root_node">
996715</field>
<field name="parent_node">
996715</field>
</data>
</node>
