in reply to Removing duplicate array elements

Hi kumar, maybe this can help you :
#/usr/bin/perl -w use strict; my @array1 = ('one','two','one','three','four','two','one'); my @array2 = (); my $index; my $in; foreach $in (@array1) { push(@array2,$in) if (!grep $array2[$_] eq $in, 0 .. $#array2); } print "@array1\n"; print "@array2\n"; __DATA__ # the result : one two one three four two one one two three four
This is not the efficent dup-finder. But it is a "way".
C-o-C

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.