in reply to manipulating a matrix

You can use grep to generate a modified copy without the sub-arrays you don't want:
use strict; use warnings; my @matrix = ( [48, 219, 11021], [72, 190, 11006], [203, 177, 11005], [301, 186, 11013], [309, 119, 11015], [309, 216, 11017], [309, 147, 11000], [343, 180, 10990], [346, 179, 10989], [451, 258, 11008], [838, 162, 11014] ); # e.g. filter out all sub-arrays with x <= 309: @matrix = grep { $_->[0] <= 309 } @matrix; local $, = " "; local $\ = "\n"; print @$_ for @matrix; __END__ Output is: 48 219 11021 72 190 11006 203 177 11005 301 186 11013 309 119 11015 309 216 11017 309 147 11000
The code block you give grep gets called once for every array element with $_ as an alias for the element. In this case the elements are references to the anonymous arrays, which can be accessed by using the dereferencing operator -> like shown above.

PS: In Perl a two dimensional array, aka an array of arrays aka a matrix, uses always anonymous arrays inside. So you don't need to mentioned that explicitly with "an array of anonymous arrays".

Replies are listed 'Best First'.
Re^2: manipulating an array of anonymous arrays ...
by chexmix (Hermit) on Apr 25, 2008 at 16:26 UTC
    Thank you. I am going to try something like this with the modification that I am seeking to "toss out" the results that fell betweentwo values. I am not sure how to modify that use of grep but will have fun experimenting with it.

    I will try to have fun with it anyway. Working on this has involved a lot of encounters between me and my limitations (current knowledge, learning speed, and so on pretty much ad infinitum). I get lost sometimes between feeling humble ("I have so much to learn") and feeling like a deer in headlights ("I will never ever get it, my chops are those of a 3 year old and I will eventually be working at a fast food chain").

    A constant diet of crow gets old, especially if like me you are vegetarian (the veggie crowcakes aren't very good, yet). :)

      grep returns all element for which the code block returns boolean true, so you have to change the code block to return true if the results are not between two values:
      my @array = grep { $_->[0] <= $low || $_->[0] >= $high } @array;
        Thanks - I worked it out! :D

        It's a small thing, but at my level that's what I have to hold onto.