No such thing as a small change | |
PerlMonks |
Comparing arrays in perl.by anand_perl (Novice) |
on Aug 06, 2008 at 05:31 UTC ( [id://702557]=perlquestion: print w/replies, xml ) | Need Help?? |
anand_perl has asked for the wisdom of the Perl Monks concerning the following question: Hi I want to compare two arrays and delete the occurances of elements in a array. For example, let the two array's be: @arr1 = ("one","two","three","four","five"); @arr2 = ("one","a","b","one","c","d","e","two","f","g","h","two","i","j","two"); I want to compare these two arrays.In arr2,there are elements of arr1 and these elements occur more than once in arr2. For example,in arr2 element "one" is repeated twice, I want to delete the other occurance of the element "one". Similarly in arr2 elelment "two" is repeated thrice, I want to delete the second and further occurance of this element "two". Can anyone help me on this..... Thanks in advance... Anand.
Back to
Seekers of Perl Wisdom
|
|