Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: grep return a set of references

by kennethk (Abbot)
on Jan 11, 2013 at 16:37 UTC ( #1012916=note: print w/replies, xml ) Need Help??

in reply to grep return a set of references

I'm having some trouble following your question/spec. See How do I post a question effectively?. I particular, providing input and expected output would probably provide a lot of clarity.

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012916]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2018-06-22 07:48 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (122 votes). Check out past polls.