in reply to finding perfect numbers

One immediate problem is identified when you enable warnings (see use strict and warnings). @perfectnumbers is out of scope when you try to print its contents.

perltidy will help you use better indentation.