Sounds like you might want an algorithm like the one provided in Algorithm::Diff.
- tye
In reply to Re: Comparing and Aligning arrays (Diff) by tye in thread Comparing and Aligning arrays by abd