Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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.

Comment on Re: grep return a set of references
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012916]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2015-11-25 12:20 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (674 votes), past polls