|P is for Practical|
Combining arrays with grep/unless?by mdunnbass (Monk)
|on Feb 09, 2007 at 20:48 UTC||Need Help??|
mdunnbass has asked for the
wisdom of the Perl Monks concerning the following question:
Yet another question from me.. I am trying to combine non-duplicate elements of 2 arrays into 1. I have read the "difference/intersection/union of 2 arrays" FAQ, and I've read the bit by vroom here, but I felt the need to be difficult. *grins*
Here's the bit I've got going so far:
Ideally, I want @group1 to contain all the elements from groups 1 and 2. Or, if for instance group2 also had a D and an E, it would contain everything but the duplicates. But, after running the above code, @group1 remains unchanged. Any glaring errors that pop out at you?
Something tells me I got this bit of code a few weeks ago here, but looking back through all of my recent questions, I must be missing it somewhere. So, sorry if this is redundant.