Re: sort problem

[email protected] ("Vos, Gert-Jan de") Thu, 7 Aug 2003 10:54:18 +0200
Newsgroups perl.riscos
Message-ID <[email protected]>
> Hi,
>=20
> I need to sort the following list into the correct order,
> anyone have any ideas on how this can be done?

print sort { ($a0, $a1) =3D ($a =3D~ /(.*?)(\d*)$/); ($b0, $b1) =3D ($b =
=3D~ /(.*?)(\d*)$/); $a0 cmp $b0 || $a1 <=3D> $b1 } <>;

Assuming your input always has the format <Textual part><Numerical part>
and you want the textual part sorted textualy and the numerical part =
numericaly,
then this should do it.

Hope this helps,

Gert-Jan