in reply to sorting arrays...
Try something like this:
This lets you isolate details for how records will be compared while sorted into a separate subroutine. (See perldoc -f sort for details). Then, you'll do something likemy @unsorted = <TOSORT>; my @sorted = sort byPhone @unsorted;
to extract and compare phone numbers. Exchange $a and $b if you want to reverse the order.sub byPhone { return (split(/\|/, $a))[1] cmp (split(/\|/, $b))[1]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: sorting arrays...
by iamrobj (Initiate) on Jul 12, 2003 at 22:43 UTC | |
by dws (Chancellor) on Jul 12, 2003 at 23:31 UTC |