topaz has asked for the wisdom of the Perl Monks concerning the following question:
For example: 100 2 -2 44 332 9 26 -4 332 9 0 -1
I want to creat a 2 dimentional array 360x360 and set it to zero then start recording the count of combnation $a $b the combanation of 332 and 9 appered twice on the list so the count will be 2
and Yes Ikegami you are right I do understand now why 361 :) thanksmy @a = ((0) x 361); my @b = ((0) x 361); my @matrix = (@a,@b) while ($line = <IN>) { @record = split(/\s+/, $line); $a = $record[0]; $b = $record[1]; @matrix [$a+180][$b+180] ++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 2 dimensional array
by ikegami (Patriarch) on Jul 28, 2011 at 19:43 UTC | |
|
Re: 2 dimensional array
by ww (Archbishop) on Jul 28, 2011 at 22:25 UTC | |
by topaz (Initiate) on Jul 29, 2011 at 00:34 UTC |