in reply to retro

Explaining this goes way beyond a simple answer. This also sounds like homework but forgive me if I'm wrong. I'm suggesting that you buy Mastering Algorithms with Perl by Jon Orwant, Jarkko Hietaniemi & John Macdonald. This book would give you a good idea on how to do what your asking for. For any of us to explain this right now would require us to write a book ourselves.

--

It just doesn't sound like you realy want to do the legwork for this.
BMaximus

The other monks on PM my not feel the same way. Therefore I do not speak for them. Only myself.