http://www.perlmonks.org?node_id=73907


in reply to Newbie seeking help.

This really smells like homework to me :-(

The answers to these questions can be found in Mastering Regular Expressions mostly.