my @kept = grep { ! m/CONDITION_FOR_DELETION/ } @array;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#! /usr/bin/perl use strict; use warnings; use Data::Dumper; my $array = [ { page => 1, }, { page => 2, }, { page => 3, }, { page => 4, }, { page => 5, }, { page => 1, }, { page => 2, }, { page => 3, }, { page => 4, }, { page => 5, }, ]; # behalte alle mit page == 5 @$array = grep { $_->{page} == 5 } @$array; # oder behalte alle mit page != 5 #@$array = grep { $_->{page} != 5 } @$array; print "Kontrolle:\n"; print Dumper $array;