in reply to Re: Perl For loops
in thread Perl For loops

Hi Monks,

I don't know what is the purpose of getting it in a "for" loop. But if we are concerned only about output or $t, can't we do something like
$t = [ @matrix ]
so that the entire program would be
my @matrix=([qw(1 2 4 4)],[qw(5 2 0 8)],[qw(9 10 11 12)],); my $t = [ @matrix ];
Or even simpler like
my $t = [ [qw(1 2 4 4)],[qw(5 2 0 8)],[qw(9 10 11 12)], ];
cheers!

-VC

Update: Appologies for the carelessness & waste of time.

Replies are listed 'Best First'.
Re^3: Perl For loops
by aufflick (Deacon) on Jul 06, 2007 at 03:34 UTC
    well, because your way $t is:
    [ [ 1, 2, 4, 4 ], [ 5, 2, 0, 8 ], [ 9, 10, 11, 12 ], ]
    when it should be:
    [ [ 1, 5, 9 ], [ 2, 2, 10 ], [ 4 ], [ 4, 8, 12 ], ]
    kinda different...