#!/usr/bin/perl use strict; use warnings; print "How many replicates? "; chomp( my $antal = <> ); print "How many Samples? "; chomp( my $size = <> ); 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 = <> ); $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"; }