#!/usr/bin/perl -w use strict; #remove "rows" that don't have a value greater than 75 my $value =75; my $rLoL = [ [78,43,87], [64,73,72], [99], [65,67,71] ]; @$rLoL = grep { (grep {$_ > $value}@$_)>=1}@$rLoL; foreach my $ref (@$rLoL) { print "@$ref\n"; } #prints #78 43 87 #99 #the inside grep above is used in a scalar context. #It basically says "do we want to keep this list or not?" #outside grep passes list ref to output based upon that #true/false decision. #grep{} works with anything that can be reduced to a #yes/no question #@LoH = grep{keys (%_) > 2}@LoH #removes hashes from List of Hashes that have fewer #than 3 keys.