Kirby_Sarah <[EMAIL PROTECTED]> writes: > Hi, > > I have instances where I want to delete duplicate elements out of an array. > Is there an easy way to do this?
Sure, The Perl Cookbook provides several ways - here's one: (Recipe 4.6, page 102) my @list = qw/one two three one two five/; my @uniq; %seen = (); foreach $item (@list) { push (@uniq, $item) unless $seen{$item}++; } #@uniq now contains qw/one two three five/; '@list' is the original array, and '@uniq' is the unique elements from that array. This method does not change @list. -RN -- Robin Norwood Red Hat, Inc. "The Sage does nothing, yet nothing remains undone." -Lao Tzu, Te Tao Ching -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]