Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://741296]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2014-07-22 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (130 votes), past polls