Just as a general comment: Most monks around here don't respond very favourably to people copying and pasting Perl code they have found somewhere on the web without putting any effort into trying to understand at least the bare minimum of it themselves. You should be able to answer most of your questions after spending about 1 - 3 hrs on some basic Perl tutorials (depending on your background in other programming languages). If you have never done any programming before, start with the llama book ... it is great fun to read and will get you a long way towards answering all the questions you asked. It may only take you a little longer.
in reply to Please Explain Code
P. S.: And yes, this is probably one of my less helpful posts in this forum.