in reply to Determining if an element is already in an array.
the foreach loop is not so convoluted. i spell if f-o-r here.
my @foo = qw(1 4 g 7 h rf s 4 6 7 9); my %foo = (); $foo{$_}=$foo[$_] for @foo; @foo=keys %foo;
@foo is your original list, and %foo is a temporary hash that you will use to hold the unique values (since every key in a hash is unique).
|
|---|