I am new to programming and i am trying the c logic to implement in Perl for the array duplicate removal.
But i am not getting required output.Can some please give pointer where did i go wrong.
#!/usr/bin/perl -w
@x = (2,2,3,1);
$n = 3;
for ($i=0;$i<$n;$i++) {
for ($j=$i+1;$j<$n;$j++) {
if ($x[$i]=$x[$j]) {
for ($k=$j;$k<$n;$k++)
{
print " pip";
$x[$k] = $x[$k+1];
print "k = $x[$k] ,j = $x[$j]\n";
$n--;
}
} else {
$j++;
}
}
}
print @x;