>
>I have one array say @test = (1,2,3,2,5). Now if you observe 2 is
>repeating in this array on second position and fourth position.
>
>My requirement is that if such value is repeating twice then i just want
>to remove one value and keep other value.
>
>So my array should look like @test = (1,2,3,5)
>
>can anybody help in this regard...
>
Hi,
For me,I always use 'grep' to handle this case.
Like:
@test = grep { ++$hash{$_} < 2 } @test;
This will remove the duplicated elements.
--
Jeff Pang
EMAIL: [EMAIL PROTECTED] AIM: jeffpang
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/