You are right,
But as I said I am still learning pearl, I am not a programmer and I have recently started learning pearl, The code I posted was small and I asked the community to let me know where I went wrong, I was stuck.
Answers from Corion and Anonymous explain a lot.
Thanks.