Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: grep return a set of references

by kennethk (Monsignor)
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-09-19 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (132 votes), past polls