Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: using File::Find for reading files in order

by leocharre (Priest)
on Feb 04, 2009 at 14:37 UTC ( #741296=note: print w/replies, xml ) Need Help??

in reply to using File::Find for reading files in order

I'm just curious here.. Why do you think
File 1
File 10
File 100
File 2
File 20
File 21
Is out of order? Or strange at all?

It's obviously sorted alphanum.
You expected to sort by comparison, by.. is two greater than, 100. It's not greater ammount, but 100 does come before 2 alphanumerically. Just wanted to point that out- because this is a bug in the coder, not the code.

If you want to be able to sort files like these as you expect, one thing to do is name them appropriately...

# rename ' ' ' 00' File\ ?; rename ' ' ' 0' File\ ??
# ls -1 File\ *
File 001
File 002
File 010
File 020
File 021
File 100
  • Comment on Re: using File::Find for reading files in order

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://741296]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-03-19 09:40 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (238 votes). Check out past polls.