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

hi monk,

i am beginar to perl,i tried to remove the duplicates from a one dimentional array.Here is my code

#!/usr/bin/perl -w @a=(1,2,3,4,5,5,6,3,7); undef %raw; @b=grep(!$raw{$_}++,@a); print "@b \n";

Originally posted as a Categorized Answer.

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