in reply to remove duplicate value in array
This is also found under Categorized Questions and Answers:
How do I find if an array has duplicate elements, if so discard it? How to find and remove duplicate elements from an array? How can I display a unique array if it contains some repeated elements
HTH,
@content = qw(1 2 3 1 2 4 2 5 4 3); print "arr @content\n"; for ($i=0; $i<=$#content; $i++) { my $count = 0; for ($j=$i+1; $j<$#content+1; $j++) { if ($content[$i] == $content[$j]) { $count++; } if ($content[$i] == $content[$j] && $count == 1) { $content[$j] = ""; } } } print "@content"; [download]
Code tags added by GrandFather