in reply to Re^2: sorting numbered words
in thread sorting numbered words
If my example doesn't work for you, modify it accordingly.
That said, I don't see how it fails (as I don't know what you expect):
#!/usr/bin/perl -w use strict; my @unsorted = <DATA>; my @sorted = map {$_->[2]} sort {$a->[0] cmp $b->[0] || $a->[1] <=> $b->[1]} map {/(\D+)(\d+)/;[$1,$2,$_]} @unsorted; print for @sorted; __DATA__ test69.something-14-14 test28.something-14-14 foo52.something-14-14 test13.something-14-14 test4.something-14-14 foo58.something-14-14 test31.something-14-14 test15.something-14-14 test59.something-14-14 foo5.something-14-14 test41.something-14-14 test38.something-14-14 foo11.something-14-14 test10.something-14-14 test8.something-14-14 test49.something-14-14 foo24.something-14-14 foo7.something-14-14 bar27.something-14-14 bar0.something-14-14 test3.something-14-14 __END__ bar0.something-14-14 bar27.something-14-14 foo5.something-14-14 foo7.something-14-14 foo11.something-14-14 foo24.something-14-14 foo52.something-14-14 foo58.something-14-14 test3.something-14-14 test4.something-14-14 test8.something-14-14 test10.something-14-14 test13.something-14-14 test15.something-14-14 test28.something-14-14 test31.something-14-14 test38.something-14-14 test41.something-14-14 test49.something-14-14 test59.something-14-14 test69.something-14-14
The OP didn't
Bug reports without logs are useless.
Further recommended reading: I know what I mean. Why don't you?
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|