Pedro Soto wrote:
> Dear all,
> I am trying to make a matrix out of a file (row-columns) using perl. In
> particular I would like to print the first row of an array of arrays which
> contains the headings of the file.
> I tried to do it but I can't print it. If used $AoA[0], I get the reference
> to the array.How can I deference it?
> Thanks in advance,
> P
>
>
> #! usr/local/bin/perl
> use warnings;
> use strict;
> my @AoA= ();
> open(IN,"genotypes_piece") || die "I can not open file\n";
> my @temp =();
> while (defined (my $line = <IN>)) {
> @temp = split/\s+/,$line;
> push(@AoA, [EMAIL PROTECTED]);
>
> }
> for (my $x = 11; $x <=$#temp; $x++) {
>      for (my $y = 1; $y <= $#AoA ; $y ++) {
>      print "At X=$x, Y=$y is", $AoA[$y][$x], "\n";
> }
> }
>   
Your problem doesn't appear to be dereferencing but your for loops.  You seem 
to have a typo of "$x = 11" and more importantly array indexes are zero based.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to