in reply to How to use a splice inside a foreach

I think you probably want to use grep.

sub filterExclude{ my $ar = $_[0] ; # REF! my $someConfig = $_[1] ; $ar=[ grep { exists($someConfig->{$_}{Exclude}) && $someConfig->{$_}{Exclude} } @$ar ]; return $ar }

Note that this won't alter the original array. (That is bad practice anyway). Best to rather call as $data=filterExclude($data,$config);

On a side note, if $someConfig->{$key} does not exist, it will be created even with the exists check.
At the same time, $someConfig->{$key}{Exclude} wouldn't be created even without the exists check.

Either install and use no autovivification; and just use $someConfig->{$_}{Exclude} as the test...
or change your test to exists ($someConfig->{$_}) && $someConfig->{$_}{Exclude}

HTH