in reply to code explanation
Also just to add here - these two sites can be very helpful in figuring out what certain Perl code does:
http://perldoc.perl.org/
and
http://search.cpan.org