Leviathan,
While this code works, it can be terribly runtime inefficient. Imagine that you have an initial data set of 10_000 elements and the desired random set is 9_990 elements. This is how
Data::Random does it under the covers and I have emailed the author with a couple of alternatives.