in reply to perl script

What have you tried thus far?

You'd probably want to take a look at using split to gather what you need.