[San-Diego-pm] Sort problem
Joel Fentin
joel at fentin.com
Tue Aug 31 16:00:28 PDT 2010
That did the trick. Thank you
On 8/30/2010 7:39 PM, Randal L. Schwartz wrote:
>>>>>> "Joel" == Joel Fentin<joel at fentin.com> writes:
>
> Joel> I've tried everything I can think of without success.
> Joel> my @A = ('aaa10.jpg','aaa9.jpg','bbb9.jpg','bbb10.jpg');
>
> Joel> The desired order:
> Joel> aaa9.jpg
> Joel> aaa10.jpg
> Joel> bbb9.jpg
> Joel> bbb10.jpg
>
> Joel> Sorted first by the text. Those with the same text sorted
> Joel> numerically.
>
> my @sorted =
> map $_->[0],
> sort { $a->[1] cmp $b->[1] or $a->[2]<=> $b->[2] }
> map [$_, /^(\D+)(\d+)/],
> @input;
>
> Untested, but I usually get this stuff mostly right. :)
>
--
Joel Fentin tel: 760-749-8863
Biz Website: http://fentin.com
Personal Website: http://fentin.com/me
More information about the San-Diego-pm
mailing list