in reply to Extract part of a list
my @good = @mixed[1,2,4]; [download]
Without knowing how you decide which data is good and which bad it's not really possible to help you.
See How (Not) To Ask A Question.