in reply to removing duplicates entries from an array

The immediate problem is that your RDup routine is returning a new array that you're not saving. IOW do something like this:

@unique = RDup(@unique);
There are a lot of ways you can improve removing duplicates, though, and there are several suggestions in the Perl FAQ list. Try perldoc -q duplicate on your machine for some suggestions.