in reply to parallel reading

Try putting <code> and </code> around your data samples, so that we can see what the data really look like.

What you want is what the unix "paste" command does. Someone has written a perl version of "paste" already (google for "perl power tools").

(update: in case you have trouble finding it, here's the source for a perl implementation of paste: