in reply to removing duplicate entries from an array
Of course, it's a huge waste to create the second array for a placeholder (even though that code is very easy to understand.) You probably want to delete the entries in place, using splice or array slices, if the array can possibly be of any length.my %seen; my @ABC; for my $element (@XYZ) { next if $seen{$element}++; push @ABC, $element; } @XYZ = @ABC;
-- Kirby, WhitePages.com
|
---|