in reply to How do I find if an array has duplicate elements, if so discard it?

I meant:
@A = (1, 2, 3, 4, 5) ;
@B = (6, 7, 7, 8, 9) ;
@C = (10, 11, 12, 13, 15) ;
@D = @A + @B + @C ;
# here is where if array has duplicate elements (since @B does) then you would want to discard @B:
foreach $element (@D) { print $element, "\n" ;
Results should be this since @B has duplicate elements:
1, 2, 3, 4, 5
10, 11, 12, 13, 15

Originally posted as a Categorized Answer.

  • Comment on Re: Clarify: How do I find if an array has duplicate elements, if so discard it?