in reply to Sorting an array on two computed fields
update: or with the new Sort::Key::Natural I have just released:use Sort::Key qw(keysort); my @array = ( '1-1', '2-5', '2', '6', '1-10', '1-3','2-1'); my @sorted = keysort { pack "N*", split /-/, $_ } @array;
use Sort::Key::Natural 'natsort'; my @sorted = natsort @array;
|
|---|