#!/usr/bin/perl -w use strict; use Data::Dumper; my $min_elements = 11; my $rLoLoL =[ [ [78,43,87], [64,73,72], [99], [65,67,71] ], [ [1,2,3], [4,5], [6,7],[8, 9, 10, 11] ], ]; @$rLoLoL = grep { (my @elements = map{@$_}@$_)>= $min_elements }@$rLoLoL; #some explanation ...most folks posting in this thread have #thousands of posts and are experienced..but perhaps this will #help others...although most folks don't go down this deep #into the thread... #the @$rLoLoL gets the list of references to matrices, the #list of lists of lists (LoLoL). # in: ...map{@$_}@$_), this last @$_ gets List of List's # the map{} takes each one of these and "flattens the matrix # out", what goes into @elements is like (78,43,87,64,73,72,99,65,67,71). # print Dumper ($rLoLoL); #the first "matrix" with 10 total elements has been removed... __END__ Prints: $VAR1 = [ [ [ 1, 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8, 9, 10, 11 ] ] ];