Other posts have given you code to do what you need, here is why your code fails.
Consider an array that has the following:
my @array = ("", "");
Now hand trace the part of clean() that splices out the blank elements.
the loop will iterate from 0 to 1
Element 0 gets spliced out, leaving the array with the singile element at index 0 = ""
and your loop iterator gets incremented to 1, but the blank element that was at position 1 is now at position 0 as a result of the splice. That element never gets a chance to be examined.
To summarize, splice()ing out array elements changes the indexes of subsequent elements, so your loop iterator wont indicate whta it was intended to.
As a "band-aid" to your function, if you change the unless() action as follows:
splice @clean, $i, 1;
$i--;
your function should work as you want it to.
But, others have offered better solutions.