I second this, you have to at least attempt the problem yourself before asking for help. It isn't just about integrity; you will never become a good programmer if you just immediately ask for the answer to even such small tasks as this. Granted, you might not actually be interested in programming and are just trying to pass a required class, but there is still a lot to learn logically from problems such as this. It's good mental exercise!
One tip from me would be that if you are more familiar with another language (say Java or Python), you can try to solve the problem in that language first so you don't get bogged down with syntax, and then apply the same logic/structure in perl.