in reply to remove duplicates with hash and grep

Tip #1 from the Basic debugging checklist: warnings

Name "main::array" used only once: possible typo at ..

Your code never populates @array (it is empty).