in reply to Re: Sorting Files with Numbers
in thread Sorting Files with Numbers

No, it won't, since numberification of the string only looks at the beginning. It will see them all as zero and compare equal in every case.

Change the order of the data in your example, since they were sorted to begin with.

[F:\]perl -e "print qq{[$_]\n} for ( sort { print 0+$a, $b, $/; $a <=> + $b } qw(file2 file20z file22s file1q file10z file12f) )" 00 00 00 00 00 [file2] [file20z] [file22s] [file1q] [file10z] [file12f]
—John

Replies are listed 'Best First'.
Re: Re: Re: Sorting Files with Numbers
by Wonko the sane (Curate) on Dec 30, 2002 at 17:19 UTC
    Ugh, your right. Thank you for pointing this out to me.
    I like the method you used to show this.

    Wonko.

      s/your/you're/

      Thanks. I wanted to make sure there was nothing magic about the operation during a sort, compared with its normal use of simply numberifying the values. That's the problem with a language that supports DWIMary.