P is for Practical | |
PerlMonks |
Re: Comparing 2-D co-ordinatesby Helter (Chaplain) |
on Jul 31, 2003 at 14:33 UTC ( [id://279593]=note: print w/replies, xml ) | Need Help?? |
In your first line of code, you are defining a subroutine to call to sort your data. You can do anything you want in a subroutine. So add the code that checks for overlaps (a bunch of compares for intersection) and if they overlap then determine which is longer and return that. As the sort goes through they should be sorted the way you want. It might be cleaner (from a code standpoint) to declare the subroutine separate, and then pass a refrence to sort. Hope this helps!
In Section
Seekers of Perl Wisdom
|
|