rbc has asked for the wisdom of the Perl Monks concerning the following question:
... The above new method does not cause a "compile time" errorsub new { my ( $pkg, $cols, $rows, $firstRow ) = @_; # where first Row is a ref to an array. my @AoA = (); # deref $firstRow and push the first array # into the array or arrays push ( @AoA, @$firstRow ); for( my $row=1; $row<$rows; $row++ ) { push( @AoA, [0..$cols] ); # I bet this wrong } bless { cols => $cols, rows => $rows, AoA => @AoA }, $pkg; }
... The error I keey running into is ...sub printElement { $obj = shift; $row = shift; $col = shift; print "AoA[$row][$col] = $obj->{AoA}[$row][$col]; # line 42 }
Edit kudra, 2002-05-05 Added what might have been missing from the title
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How does one
by thelenm (Vicar) on May 03, 2002 at 21:37 UTC | |
|
Re: How does one
by JayBonci (Curate) on May 03, 2002 at 21:42 UTC | |
|
(crazyinsomniac: DumperX) Re: How does one
by crazyinsomniac (Prior) on May 04, 2002 at 01:23 UTC | |
|
Re: How does one
by tachyon (Chancellor) on May 04, 2002 at 07:32 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |