Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012916]
help
Chatterbox?
[Copacetic]: I'm a new user. If I select "submit" for a new question it goes to a "Permission Denied" page. Why is this?
[LanX]: does it say why?

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-05-25 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?