[Chicago-talk] Array Slices - of columns

Jay Strauss me at heyjay.com
Wed Dec 2 17:38:00 PST 2009


Hi All, hope you had a nice thanksgiving.

If I have a 10x10 array of arrays like:

[40 8 79 8 73 71 77 35 12 67]
[4 79 10 90 45 17 30 29 65 86]
[56 86 5 34 23 79 17 83 24 85]
[58 85 46 53 15 31 34 4 14 15]
[68 15 97 21 81 95 71 82 26 90]
[59 70 11 82 39 25 36 84 88 13]
[66 6 85 1 84 17 27 58 60 94]
[34 10 38 90 32 0 56 14 23 70]
[71 23 5 97 4 71 27 20 11 87]
[5 8 23 30 97 16 10 93 16 67]

Is there any notation I can use to get "column 1", i.e. $a[0][0], $a[1][0],
$a[2][0]... without looping over the whole structure

I need to find the max value in each column

I know how to do it in a loop, but I thought maybe there was some neato way
in a slice.

Thanks
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20091202/a57f251a/attachment.html>


More information about the Chicago-talk mailing list