in reply to Multidimensional arrayrefs constructed from anonymous arrayrefs

It might be easier (and faster asymptotically) to just build a new array in this case:

my @new; foreach my $array ($values) { my @inner; foreach my $value ($array) { push @inner, $value if $value ne "UNKNOWN" } push @new, \@inner } $values = \@new;

Or, if you like to be fancy:

$values = [ grep { $_ = [ grep { $_ ne "UNKNOWN" } @$_ ] } @$values ]