in reply to Explain the code

Besides reading up on grep, you might want to take a look at this write-up on Perl idioms. It gives a very short, but very clear, description of how grep and map are used.