in reply to grep return a set of references
I think you are saying you want to remove already processed elements of the array referenced in $aref_hrefs_inn. You've correctly identified that the element of @$search_array is not linked by lvalue. So, why not use a hash to cache which elements need to go?
my %to_be_deleted; foreach my $inn_href (@$search_array) { if (check_match($args_href) == 1) { if ($$flags_href{unique} == 1) { $to_be_deleted{$inn_href}++; } last; } } @$aref_hrefs_inn = grep !$to_be_deleted{$_}, @$aref_hrefs_inn;
Code untested, as you've got a lot going on there.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|