steverippl has asked for the wisdom of the Perl Monks concerning the following question:
You get the idea... why am I getting 7 at the end instead of 1. I mean, I must be over-writing each line or something, but I don't know what!#! /usr/bin/perl $a = 1; $b = 2; $c = 3; $d = 4; $e = 5; $f = 6; $g = 7; $h = 8; $i = 9; @row = (); @matrix=(); push (@row, $a); push (@row, $b); push (@row, $c); print "@row\n"; push(@{$matrix}, \@row); @row = (); push (@row, $d); push (@row, $e); push (@row, $f); print "@row\n"; push(@{$matrix}, \@row); @row = (); push (@row, $g); push (@row, $h); push (@row, $i); print "@row\n"; push(@{$matrix}, \@row); print "$$matrix[0][0] \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: simple matrix
by ikegami (Patriarch) on May 04, 2006 at 03:06 UTC | |
|
Re: simple matrix
by GrandFather (Saint) on May 04, 2006 at 03:13 UTC | |
|
Re: simple matrix
by Samy_rio (Vicar) on May 04, 2006 at 04:10 UTC | |
|
Re: simple matrix
by jdtoronto (Prior) on May 04, 2006 at 03:29 UTC | |
|
Re: simple matrix
by davidrw (Prior) on May 04, 2006 at 13:20 UTC | |
|
Re: simple matrix
by steverippl (Novice) on May 04, 2006 at 15:28 UTC | |
by ikegami (Patriarch) on May 04, 2006 at 16:40 UTC |