$i=1; @arr=(); print "Enter a number"; while(1) { $val=<>; if ($i eq 1) #Enter the first entry into the array directly. { push(@arr,$val); # push it into the array 'arr'. } else {for($x=1;$x<=scalar(@arr);$x++) #run through the 'arr'. { if($arr[$x] eq $val) # check if every entry is unique. { print "Already exist at $x position";# if it is not, tell the user to enter a unique one and ignore the present (redundant)entry. exit;} else { push(@arr,$val); #If unique, push into the array. } } } print" @arr \t"; } print "Array is:", @arr; #display the array.