in reply to Sort files

No, at least not as desired.

If my guess is correct, you get:

my @sorted_files_Test_flat_file_write_over_name_only = map { $_->[0] } sort { $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0] } map { [ $_, (stat)[9] ] } @files_Test_flat_file_write_over_name_only;
or the faster
my @sorted_files_Test_flat_file_write_over_name_only = map { substr($_, 11) } sort map { sprintf('%011d%s', (stat)[9], $_) } @files_Test_flat_file_write_over_name_only;

Update: Formatting changes. Added code.

Replies are listed 'Best First'.
Re^2: Sort files
by salva (Canon) on Apr 13, 2006 at 15:56 UTC
    or the fastest:
    use Sort::Key::Multi 'is_keysort'; # is_ => integer, string my @sorted = is_keysort { scalar((stat)[9]), $_ } @filenames;
    I am using (stat)[8] instead of (stat)[9] because that's what the OP probably wants.

    The scalar around (stat)[9] is required because stat could fail returning an empty list, and in list context, (()[9], $_) is equivalent to ($_). It is also required on ikegami GRT version.

    update: oops, stat[9] was ok, it seems I didn't count for the mtime position on stat return values properly, thanks ikegami for pointing it out.