in reply to Traverse and calculate in 2D array

I'd say your data structure is not ideal, it's surely much more usefull to improve the structure than the program working on it.

while( @data > 1 ){ my $i = shift @data; my $o = shift @data; printf "%d %d %d\n", $i->[0] - $o->[0], $i->[2] , $o->[2]; }

This will clobber your array.

update: sorry, PRE=>CODE

--
http://fruiture.de

Replies are listed 'Best First'.
Re: Re: Array
by Anonymous Monk on Nov 27, 2002 at 19:20 UTC
    Do you know why your routine is returning this data:
    0 258381720 -100889581 0 258385268 -100885569
    instead of:
    0 258381720 4194077715 0 258385268 4194081727
    Thanks in advance

      Because 4194081727 needs 32 Bit to be stored correctly as number. Looks like the '%d' template wants a smaller int. Using '%s' will help.

      --
      http://fruiture.de